#include <stdio.h>
int main() {
int num, abs;
printf("정수 입력: ");
scanf("%d", &num); //
abs = num>0 ? num: num*(-1);
printf("절댓값: %d \n", abs);
return 0;
}
// (num1>num2) ? (num1) : (num1>2) ? 0 : -1; // 삼항연산자
// // 삼항연산자를 if-else문으로 변환
// if(num1>num2){
// return num1;
// if(num1>2)
// return 0;
// else
// return -1;
// }
// else{
// return num2;
// }
To embed this project on your website, copy the following code and paste it into your website's HTML: