728x90
include <stdio.h>
#include <string.h>
int main(void)
{
// 단위 변환
int input;
char unit[256];
printf("숫자를 입력하시오.\n");
scanf_s("%d", &input);
printf("단위를 입력하시오.\n");
scanf_s("%s",unit, sizeof(unit));
if (strcmp(unit,"m"))
{
}
else
{
printf("Km 는 %d \n", input * 1000);
printf("Mm 는 %d \n", input * 1000000);
}
if (strcmp(unit, "Km"))
{
}
else
{
printf("m 는 %f \n", input * 0.001);
printf("Mm 는 %d \n", input * 1000);
}
if (strcmp(unit, "Mm"))
{
}
else
{
printf("m 는 %f \n", input * 0.001);
printf("Km 는 %f \n", input * 0.000001);
}
return 0;
}
결과
728x90
'개발자 모드 > C언어' 카테고리의 다른 글
C언어 기초 Scanf / printf 관련 간단 프로젝트 (0) | 2021.09.12 |
---|---|
C언어 문자 출력하기 기초 (0) | 2021.09.11 |
C언어 반복문을 이용한 구구단 (0) | 2021.09.11 |
netsh와 system함수로 ip 변경하는 법 #2 (0) | 2021.09.09 |
netsh와 system함수로 ip 변경하는법 (0) | 2021.09.09 |