목록C (66)
printf("ho_tari\n");
#include int main(void) { int celsius; double fahr; scanf("%d", &celsius); fahr = 9.0 / 5.0 * celsius + 32; printf("celsius : %d ---> fahr : %.1f\n", celsius, fahr); return 0; }
#include int main(void) { int nums[10] = {50, 90, 30, 100, 80, 10, 20, 40, 70, 60}; //initialized list // bubble sorting for (int i = 9; i >= 1; --i) { for (int j = 0; j nums[j+1]) { int tmp = nums[j]; nums[j] = nums[j+1]; nums[j+1] = tmp; } } } for (int i = 0; i < 10; ++i) { printf("%d ", nums[i]); } printf("\n"); return 0; }
#include int main(void) { char ch; scanf("%c", &ch); if(ch >= 'A' && ch
#include #include #include int main(void) { int question[3]; srand(time(NULL)); question[0] = rand() % 9 + 1; do { question[1] = rand() % 9 + 1; }while(question[0] == question[1]); do { question[2] = rand() % 9 + 1; }while(question[0] == question[2] || question[1] == question[2]); printf("question: %d %d %d\n", question[0], question[1], question[2]); int count = 0; for(;;) // while(1) { ++count;..
#include int main(void) { int a, b, c; printf("Korean: "); scanf("%d", &a); printf("English: "); scanf("%d", &b); printf("Math: "); scanf("%d", &c); int sum; double average; sum = a + b + c; average = sum / 3.0; printf("-----------------------\n"); printf("Sum: %d\nAverage: %.2f\n", sum, average); return 0; }
#include int main(void) { int nums1[] = {1, 2, 3, 4, 5}; int nums2[] = {1, 2, 3, 4, 5}; /* if (nums1 == nums2) // &nums1[0] == &nums2[0]; { printf("nums1 and nums2 are equal\n"); } else { printf("nums1 and nums2 are not equal\n"); } */ int i; for (i = 0; i < 5; ++i) { if (nums1[i] != nums2[i]) { break; } } if (i == 5) { printf("nums1 and nums2 are equal\n"); // equal } else { printf("nums1 and n..
#include int main(void) { int nums1[] = {1, 2, 3, 4, 5}; int nums2[5]; //nums2 = nums1; //&nums2[0] = &nums1[0]; -- error for (int i = 0; i < 5; ++i) { nums2[i] = nums1[i]; } for (int i = 0; i < 5; ++i) { printf("%d ", nums2[i]); } printf("\n"); return 0; }
#include int main(void) { int a; int b; printf("input 2 nums : "); scanf("%d %d", &a, &b); printf("%d + %d = %d\n", a, b, a + b); printf("%d - %d = %d\n", a, b, a - b); printf("%d * %d = %d\n", a, b, a * b); printf("%d / %d = %d\n", a, b, a / b); printf("%d %% %d = %d\n", a, b, a % b); return 0; }