4차 9번4차 9번

Posted at 2013. 10. 31. 13:43 | Posted in 2학기/C언어


#include <stdio.h>

int main()

{

double x;

char op;



printf("입력단위가 cm이면 \'c\'나 \'C\'를, inch이면 \'i\'나 \'I\'를 입력하세요.\n");

printf("입력단위 : ");

scanf("%c", &op);

printf("입력 값 : ");

scanf("%lf", &x);


if (op == 'i' || op == 'I')

printf("입력한 %0.2lf inch는 %0.2lf cm입니다.", x, x*2.54);

else if (op == 'c' || op == 'C')

printf("입력한 %0.2lf cm는 %0.2lf inch입니다.", x, x/2.54);



return 0;

}



'2학기 > C언어' 카테고리의 다른 글

while 반복문  (0) 2013.11.06
4차 10번  (0) 2013.10.31
4차 8번  (0) 2013.10.31
4차 7번  (0) 2013.10.31
4차 6번  (0) 2013.10.31
//