Notice
Recent Posts
Recent Comments
Creative Code
posZeroNeg2 (양수,음수,0 판단 삼항연산자) 본문
#include <stdio.h>
int main(void)
{
int num;
printf("정수입력 : \n");
scanf("%d",&num);
/*
if (num > 0){
printf("%d is positive \n",num);
} else if (num == 0) {
printf("%d is zero \n",num);
} else {
printf("%d is negative \n",num);
}
*/
printf("%d is a %s num\n",num,(num>0) ? "positive" : (num == 0) ? "zero":"negative");
return 0;
}
'C Programming' 카테고리의 다른 글
printA2Z2 (A부터 Z까지 출력) (1) | 2023.08.01 |
---|---|
printA2Z.c(A부터 Z까지 출력) (1) | 2023.08.01 |
passFail3.c(합격,실패 판별 삼항연산자) (0) | 2023.08.01 |
ordinaryLeap3.c(윤년,평년 판별 삼항연산자) (1) | 2023.08.01 |
oddEven3.c(홀수,짝수 판단 삼항연산자) (1) | 2023.08.01 |