523 : 연산자 - 자가진단6
2018. 2. 28. 14:28ㆍalgorithm/기초다지기
523 : 연산자 - 자가진단6

두 개의 정수를 입력받아서 다음과 같이 4가지 관계연산자의 결과를 출력하시오.
이때 입력받은 두 정수를 이용하여 출력하시오.
(JAVA는 1이면 true, 0이면 false를 출력한다.)
![]() 4 5 | ![]() 4 > 5 --- 0 4 < 5 --- 1 4 >= 5 --- 0 4 <= 5 --- 1 |
-----해설-----
/**************************************************************
Problem: 523
User: ldj6192
Language: C++
Result: Success
Time:0 ms
Memory:1092 kb
****************************************************************/
#include
int main()
{
int a, b;
int result1, result2, result3, result4;
scanf("%d %d", &a, &b);
result1 = (a > b);
result2 = (a < b);
result3 = (a >= b);
result4 = (a <= b);
printf("%d > %d --- %d \n", a, b, result1);
printf("%d < %d --- %d \n", a, b, result2);
printf("%d >= %d --- %d \n", a, b, result3);
printf("%d <= %d --- %d \n", a, b, result4);
return 0;
}
'algorithm > 기초다지기' 카테고리의 다른 글
| 525 : 연산자 - 자가진단8 (0) | 2018.02.28 |
|---|---|
| 524 : 연산자 - 자가진단7 (0) | 2018.02.28 |
| 522 : 연산자 - 자가진단5 (0) | 2018.02.28 |
| 521 : 연산자 - 자가진단4 (0) | 2018.02.28 |
| 520 : 연산자 - 자가진단3 (0) | 2018.02.28 |

