[C] Error expected ';' before 'printf'
조회수 1632회
#include<stdio.h>
int main()
{
int A;
int B;
scanf("%d%d",&A,&B);
if (A>B)
printf(">");
else if(A=B)
printf("==");
else (A<B)
printf("<");
}
왜 작동이 안되는지 잘모르겠네요.
13 6 D:\시스템\Desktop\이름없음1.cpp [Error] expected ';' before 'printf'
계속 뜨는데 먼말인지 모르겠어요.
-
(•́ ✖ •̀)
알 수 없는 사용자 - 〉
2 답변
-
#include<stdio.h> int main() { int A; int B; scanf("%d%d",&A,&B); if (A>B) printf(">"); else if(A=B) printf("=="); else (A<B) // <------- !!!!! printf("<"); }
else
다음에는 조건이 필요 없습니다.else (A<B)
에서(A<B)
를 지우세요. -
- A==B : 같은지 비교하는 것은 == 이어야 함
- else 문은 실행문장만 있어야 함.
- main함수의 리턴값이 int 형태이므로 return 0; 등이 필요함.
-
(•́ ✖ •̀)
알 수 없는 사용자
댓글 입력