fork download
  1. #include <stdio.h>
  2. #define PI 3.14
  3. #define mPI 3.141592
  4. int main(void)
  5. {
  6. //1-1번
  7. printf("! @ # $ ^ & *");
  8.  
  9. //1-2번
  10. printf("523.45, 238.34567E3, 33489.134E-3");
  11.  
  12. //1-3번
  13. printf("\"C\" 언어는 재미있는 \'프로그래밍 언어\'이네요.");
  14.  
  15. //2-1번
  16. printf("%d \n", 047);
  17.  
  18. //2-2번
  19. printf("%d \n", 0x3df);
  20.  
  21. //3번
  22. printf("원의 면적 = %lf\n", 2.0 * 3.14 * 6.89);
  23.  
  24. //4번
  25. printf("%d", 24 * 3600);
  26.  
  27. //5번
  28. int seconds = 60 * 60 * 24;
  29. printf("하루는 %d초.\n", seconds);
  30.  
  31. //6번
  32. int point1 = 95;
  33. int point2 = 84;
  34. int total = point1 + point2;
  35. printf("중간고사: %d\n", point1);
  36. printf("기말고사: %d\n", point2);
  37. printf("합계: %d\n", total);
  38.  
  39. //7번
  40. int point1 = 95;
  41. int point2 = 84;
  42. int total = point1 + point2;
  43. printf("중간고사: %d\n", point1);
  44. printf("기말고사: %d\n", point2);
  45. printf("합계: %d\n", total);
  46. printf("평균: %d\n", total / 2);
  47. printf("평균: %f\n", total / 2.0);
  48.  
  49. //8번
  50. printf("%2d %2d %2d\n", 1, 01, 0x1);
  51. printf("%2d %2d %2d\n", 2, 02, 0x2);
  52. printf("%2d %2d %2d\n", 3, 03, 0x3);
  53. printf("%2d %2d %2d\n", 4, 04, 0x4);
  54. printf("%2d %2d %2d\n", 5, 05, 0x5);
  55. printf("%2d %2d %2d\n", 6, 06, 0x6);
  56. printf("%2d %2d %2d\n", 7, 07, 0x7);
  57. printf("%2d %2d %2d\n", 8, 010, 0x8);
  58. printf("%2d %2d %2d\n", 9, 011, 0x9);
  59. printf("%2d %2d %2d\n", 10, 012, 0xA);
  60. printf("%2d %2d %2d\n", 11, 013, 0xB);
  61. printf("%2d %2d %2d\n", 12, 014, 0xC);
  62. printf("%2d %2d %2d\n", 13, 015, 0xD);
  63. printf("%2d %2d %2d\n", 14, 016, 0xE);
  64. printf("%2d %2d %2d\n", 15, 017, 0xF);
  65. printf("%2d %2d %2d\n", 16, 020, 0x10);
  66.  
  67. //9번
  68. double r = 7.58;
  69. double area = r * r * PI;
  70. double cir = 2 * PI * r;
  71. printf("면적 : %lf, 둘레 : %lf\n", area, cir);
  72.  
  73. //10번
  74. double area2 = r * r * mPI;
  75. double cir2 = 2 * mPI * r;
  76. printf("면적 : %lf, 둘레 : %lf\n", area2, cir2);
  77.  
  78. //11번
  79. int f1 = 10;
  80. int f2 = 50;
  81. int f3 = 80;
  82. int f4 = 100;
  83.  
  84. double ftoc1 = 5.0 / 9.0*(f1 - 32.0);
  85. double ftoc2 = 5.0 / 9.0*(f2 - 32.0);
  86. double ftoc3 = 5.0 / 9.0*(f3 - 32.0);
  87. double ftoc4 = 5.0 / 9.0*(f4 - 32.0);
  88.  
  89. printf("10, 50, 80, 100 => %f %f %f %f\n", ftoc1, ftoc2, ftoc3, ftoc4);
  90.  
  91. //12번
  92. int c1 = -10;
  93. int c2 = 5;
  94. int c3 = 15;
  95. int c4 = 25;
  96. int c5 = 35;
  97.  
  98. double ctof1 = (9.0 / 5.0)*c1 + 32.0;
  99. double ctof2 = (9.0 / 5.0)*c2 + 32.0;
  100. double ctof3 = (9.0 / 5.0)*c3 + 32.0;
  101. double ctof4 = (9.0 / 5.0)*c4 + 32.0;
  102. double ctof5 = (9.0 / 5.0)*c5 + 32.0;
  103.  
  104. printf("-10, 5, 15, 25, 35 => %f %f %f %f %f\n", ctof1, ctof2, ctof3, ctof4, ctof5);
  105.  
  106. //13번
  107. printf("\a수업시간 입니다.\n");
  108.  
  109. //14번
  110. printf("%c %c %c %c %c\n", 041, 042, 043, 044, 045);
  111.  
  112. //15번
  113.  
  114. int a1 = 18;
  115. int a2 = 25;
  116. int a3 = 32;
  117. int a4 = 44;
  118. int a5 = 52;
  119.  
  120. double atob1 = a1*3.305785;
  121. double atob2 = a2*3.305785;
  122. double atob3 = a3*3.305785;
  123. double atob4 = a4*3.305785;
  124. double atob5 = a5*3.305785;
  125.  
  126. printf("18평, 25평, 32평, 44평, 52평 => %f %f %f %f %f\n", atob1, atob2, atob3, atob4, atob5);
  127.  
  128. //16번
  129. int m1 = 60;
  130. int m2 = 80;
  131. int m3 = 100;
  132. int m4 = 120;
  133.  
  134. double ktom1 = m1*0.621371;
  135. double ktom2 = m2*0.621371;
  136. double ktom3 = m3*0.621371;
  137. double ktom4 = m4*0.621371;
  138.  
  139. printf("60km, 80km, 100km, 120km => %f %f %f %f\n", ktom1, ktom2, ktom3, ktom4);
  140.  
  141. //17번
  142. printf("다음문자 : %c, 8진수 코드값 : %o, 10진수 코드값 : %d, 16진수 코드값 : %x\n", '#' + 1, '#', '#', '#');
  143. printf("다음문자 : %c, 8진수 코드값 : %o, 10진수 코드값 : %d, 16진수 코드값 : %x\n", '$' + 1, '$', '$', '$');
  144. printf("다음문자 : %c, 8진수 코드값 : %o, 10진수 코드값 : %d, 16진수 코드값 : %x\n", '^' + 1, '^', '^', '^');
  145. printf("다음문자 : %c, 8진수 코드값 : %o, 10진수 코드값 : %d, 16진수 코드값 : %x\n", '&' + 1, '&', '&', '&');
  146. printf("다음문자 : %c, 8진수 코드값 : %o, 10진수 코드값 : %d, 16진수 코드값 : %x\n", '*' + 1, '*', '*', '*');
  147.  
  148. //18번
  149. printf("'A'+2 = %c\n", 'A' + 2);
  150. printf("'A'+5 = %c\n", 'A' + 5);
  151. printf("'S'-1 = %c\n", 'S' - 1);
  152. printf("'S'-3 = %c\n", 'S' - 3);
  153.  
  154. //19번
  155. int w = 1000000;
  156.  
  157. double wtod = w / 1120.0;
  158.  
  159. printf("%f 달러 입니다.\n", wtod);
  160.  
  161. //20번
  162. long long int h = 117900000;
  163. long long int cw = 2871000000;
  164.  
  165. long long int stocw = cw - h;
  166.  
  167. printf("%lld\n", stocw);
  168.  
  169. return 0;
  170. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:40:8: error: redefinition of ‘point1’
    int point1 = 95;
        ^~~~~~
prog.c:32:8: note: previous definition of ‘point1’ was here
    int point1 = 95;
        ^~~~~~
prog.c:41:8: error: redefinition of ‘point2’
    int point2 = 84;
        ^~~~~~
prog.c:33:8: note: previous definition of ‘point2’ was here
    int point2 = 84;
        ^~~~~~
prog.c:42:8: error: redefinition of ‘total’
    int total = point1 + point2;
        ^~~~~
prog.c:34:8: note: previous definition of ‘total’ was here
    int total = point1 + point2;
        ^~~~~
stdout
Standard output is empty