컴퓨터/프로그래밍

05-04

review777777 2011. 6. 16. 01:51
반응형

사용자로 부터 정수 세개를 입력받아 정수형 변수 a, b, c에 각각 저장한후, 조건 연산자를 사용하여 이들 변수 중 가장 큰 값을 출력하는 프로그램


#include<stdio.h>
int main(void)
{
 int a,b,c;
 int temp,max;
 printf("Put an integer :"),scanf("%d",&a);
 printf("Put an integer :"),scanf("%d",&b);
 printf("Put an integer :"),scanf("%d",&c); 

 temp = (a>b)?a:b;
 max = (temp>c)?temp:c;

 printf("The maximum : %d\n",max);
}

반응형

'컴퓨터 > 프로그래밍' 카테고리의 다른 글

1부터 100까지 숫자중 임의의 숫자 추측하기  (0) 2011.08.05
python 처음 시작하기  (0) 2011.08.05
05-07  (0) 2011.06.16
05-02  (0) 2011.05.11
04-03  (0) 2011.05.11
02-04  (0) 2011.05.11
02-03  (0) 2011.05.11