인프런 커뮤니티 질문&답변
똑같이 쳤는데, 아무런 것도 출력이 되지 않습니다! printf도 확실하게 쳤습니다!
작성
·
180
0
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main() { double seed_money, target_money, annual_interest; printf("Input seed money : "); scanf("%lf", &seed_money); // double이라서 lf 사용!! printf("Input target money : "); scanf("%lf", &target_money); printf("Input annual interest (%%) : "); // % 기호 출력 %% scanf("%lf", &annual_interest); double fund = seed_money; int year_count = 0; while (fund < target_money); { //fund = fund + fund * annual_interest / 100.0; fund += fund * annual_interest / 100.0; //year_count = year_count + 1; //year_count += 1; year_count++; printf("Year %d, fund %f\n", year_count, fund); } printf("It takes %d years\n", year_count); return 0; }
이렇게 작성을 하였습니다. 세 가지(seed target annual)입력하고 나서 줄바뀜이 일어나고 아무런 것들도 출력이 일어나지 않는데 이건 무슨 현상일까요??
콘솔창에 타자를 쳐도 아무것도 안쳐지고, 타자를 치는 부분을 의미하는 하얀색 네모가 계속 껌뻑거리고만 있습니다...!
퀴즈
프로그래밍에서 반복 루프(repetition loop)를 사용하는 가장 주된 이유는 무엇일까요?
프로그램의 길이를 늘리기 위해
동일하거나 유사한 작업을 효율적으로 반복하기 위해
오류 메시지를 확인하기 위해
변수의 선언을 간소화하기 위해
답변 1
1





