본문 바로가기

C언어

2019.12.07 C언어 기초 플러스 3일차(2일차하고 이어짐)

2.

1
2
3
4
5
6
7
8
9
10
11
12
#include <stdio.h>
 
int main()
{
    int a;
 
    printf("아스키코드를 입력하시오 : ");
    scanf("%d"&a);
    printf("%d에 해당하는 문자 : %c", a, a);
 
    return 0;
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

3.

1
2
3
4
5
6
7
8
9
#include <stdio.h>
 
int main()
{
    printf("\a갑작스런 소리에 깜짝 놀라 샐리는 외쳤다,\n");
    printf("\"호박대왕이다!\"");
 
    return 0;
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

4.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
 
int main()
{
    float a;
 
    printf("부등소수점 수를 입력하시오 : ");
    scanf("%f"&a);
    printf("고정 소수점 표기 : %f\n", a);
    printf("지수 표기 : %e\n", a);
    printf("p 표기 : %a\n", a);
 
    return 0;
}
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

5.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>
 
int main()
{
    float age;
    float second;
 
    printf("당신의 나이를 입력하세요 : ");
    scanf("%f"&age);
 
    second = age * 3.156 * 10e7;
 
    printf("초 단위 : %.0f", second);
 
    return 0;
}
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

6.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
 
int main()
{
    float quart;
    float gram = 950;
    float jilryang = 3.0e-23;
    float gaesu;
 
    printf("물의 쿼트 양을 적으시오 : ");
    scanf("%f"&quart);
 
    gaesu = quart * gram / jilryang;
 
    printf("물 분자의 개수 : %e", gaesu);
 
    return 0;
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

7.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>
 
int main()
{
    float cm, inch;
 
    printf("cm를 입력하십시오 : ");
    scanf("%f"&cm);
 
    inch = cm * 0.393701;
 
    printf("%fcm의 인치 : %f", cm, inch);
 
    return 0;
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

8.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
 
int main()
{
    float cups;
    float pint;
    float ounces;
    float tablespoons;
    float teaspoons;
 
    printf("cups를 입력하십시오 : ");
    scanf("%f"&cups);
 
    pint = cups / 2;
    ounces = cups * 8;
    tablespoons = ounces * 2;
    teaspoons = tablespoons * 3;
 
    printf("pint = %f\n", pint);
    printf("ounces : %f\n", ounces);
    printf("tablespoons : %f\n", tablespoons);
    printf("teaspoons : %f\n", teaspoons);
 
    return 0;
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs