Recent Posts
printf("ho_tari\n");
oddEven 본문
#include <stdio.h>
int main(void)
{
int num;
printf("input num : ");
scanf("%d", &num);
//int isOdd = (num % 2 == 1);
//int isEven = (num % 2 == 0);
//printf("%d is odd : %d\n", num, isOdd);
if (num % 2 /* == 1*/)
{
printf("%d is odd\n", num);
}
else
{
printf("%d is even\n", num);
}
return 0;
}
#include <stdio.h>
int main(void)
{
int num;
printf("input num : ");
scanf("%d", &num);
//int isOdd = (num % 2 == 1);
//int isEven = (num % 2 == 0);
//printf("%d is odd : %d\n", num, isOdd);
// if (num % 2 /* == 1*/)
// {
// printf("%d is odd\n", num);
// }
// else
// {
// printf("%d is even\n", num);
// }
printf("%d is a %s\n", num, (num % 2) ? "odd" : "even");
return 0;
}
<compile 결과>
'C' 카테고리의 다른 글
ordinaryLeap (0) | 2023.09.01 |
---|---|
one2Ten (0) | 2023.09.01 |
myProfile (0) | 2023.09.01 |
multiplyTable (0) | 2023.09.01 |
maxMidMin (0) | 2023.09.01 |