[c언어]수식과 연산자-5

hyewon9913·2022년 1월 14일
0

C언어 기초

목록 보기
5/6

#include<stdio.h>

int main(){

int input, a, b, c, max;

scanf("%d", &input);

a = input / 100;		//첫째 자리 a 입니다.

b = input % 100 / 10;	//둘째 자리 b 입니다.

c = input % 10;		//셋째자리 c 입니다.

(a > b) && (a > c) ? max = a : printf("");		//a가 가장 크다면 max = a;

(b > a) && (b > c) ? max = b : printf("");		//b가 가장 크다면 max = b;

(c > a) && (c > b) ? max = c : printf("");		//c가 가장 크다면 max = c;

printf("%d", max);


return 0;

}

profile
차근차근 굴러가는 코딩일지

0개의 댓글