반응형
jungol 161부터 jungol 170까지 c언어로 작성된 코드입니다.
참고해 주시면 좋을 것 같습니다.
jungol 161
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int arr1[11] = { 0, };
int n;
int count;
count = 0;
while (count < 100)
{
scanf("%d", &n);
if (n == 0)
{
break;
}
else
{
n /= 10;
arr1[n]++;
count++;
}
}
for (int i = 10; i > -1; i--)
{
if (arr1[i] != 0)
{
printf("%d : %d person\n", i * 10, arr1[i]);
}
else
{
continue;
}
}
return 0;
}
jungol 162
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int arr1[11] = { 0, };
int n;
scanf("%d", &n);
arr1[0] = n;
scanf("%d", &n);
arr1[1] = n;
printf("%d %d ", arr1[0], arr1[1]);
for (int i = 2; i < 10; i++)
{
arr1[i] = (arr1[i-1] + arr1[i-2]) % 10;
printf("%d ", arr1[i]);
}
return 0;
}
jungol 163
#include <stdio.h>
int main(void)
{
int arr1[4][3] = { {3, 5, 9}, {2, 11, 5}, {8, 30, 10}, {22, 5, 1} }, n = 0;
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 3; j++)
{
printf("%d ", arr1[i][j]);
n += arr1[i][j];
}
printf("\n");
}
printf("%d\n", n);
return 0;
}
jungol 164
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int arr[5] = { 0, };
int arr1[4];
int arr2[4];
int arr3[4];
int arr4[4];
printf("1class? ");
for (int i = 0; i < 3; i++)
{
scanf("%d", &arr1[i]);
arr[0] += arr1[i];
}
printf("2class? ");
for (int i = 0; i < 3; i++)
{
scanf("%d", &arr2[i]);
arr[1] += arr2[i];
}
printf("3class? ");
for (int i = 0; i < 3; i++)
{
scanf("%d", &arr3[i]);
arr[2] += arr3[i];
}
printf("4class? ");
for (int i = 0; i < 3; i++)
{
scanf("%d", &arr4[i]);
arr[3] += arr4[i];
}
for (int i = 0; i < 4; i++)
{
printf("%dclass : %d\n", i + 1, arr[i]);
}
return 0;
}
jungol 165
#include <stdio.h>
int main(void)
{
int arr1[8] = { 0, 1, 0, 1, 0, 1, 0 };
int arr2[8] = { 0, };
int arr3[8] = { 0, };
int arr4[8] = { 0, };
int arr5[8] = { 0, };
for (int i = 1; i < 6; i++)
{
printf("%d ", arr1[i]);
}
printf("\n");
for (int i = 1; i < 6; i++)
{
arr2[i] = arr1[i - 1] + arr1[i + 1];
printf("%d ", arr2[i]);
}
printf("\n");
for (int i = 1; i < 6; i++)
{
arr3[i] = arr2[i - 1] + arr2[i + 1];
printf("%d ", arr3[i]);
}
printf("\n");
for (int i = 1; i < 6; i++)
{
arr4[i] = arr3[i - 1] + arr3[i + 1];
printf("%d ", arr4[i]);
}
printf("\n");
for (int i = 1; i < 6; i++)
{
arr5[i] = arr4[i - 1] + arr4[i + 1];
printf("%d ", arr5[i]);
}
printf("\n");
return 0;
}
jungol 166
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int arr[2][3] = { 0, };
int arr1[2][3] = { 0, };
int arr2[2][3] = { 0, };
int n;
printf("first array\n");
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
scanf("%d", &n);
arr1[i][j] = n;
}
}
printf("second array\n");
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
scanf("%d", &n);
arr2[i][j] = n;
}
}
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
arr[i][j] = arr1[i][j] * arr2[i][j];
printf("%d ", arr[i][j]);
}
printf("\n");
}
return 0;
}
jungol 167
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int arr[4][2] = { 0, };
int n;
int sum;
sum = 0;
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 2; j++)
{
scanf("%d", &n);
arr[i][j] = n;
sum += arr[i][j];
}
}
for (int i = 0; i < 4; i++)
{
printf("%d ", (arr[i][0] + arr[i][1]) / 2);
}
printf("\n");
for (int i = 0; i < 2; i++)
{
printf("%d ", (arr[0][i] + arr[1][i] + arr[2][i] + arr[3][i]) / 4);
}
printf("\n");
printf("%d\n", sum / 8);
return 0;
}
jungol 168
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int arr[11][11] = { 0, };
int n;
int sum;
sum = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
arr[i][1] = 1;
}
for (int i = 1; i < n; i++)
{
for (int j = 1; j <= n; j++)
{
arr[i][j] = arr[i - 1][j - 1] + arr[i - 1][j];
if (arr[i][j] == 0)
{
j = n;
}
else
{
continue;
}
}
printf("\n");
}
for (int i = n - 1; i >= 0; i--)
{
for (int j = 0; j <= n; j++)
{
if (arr[i][j] != 0)
{
printf("%d ", arr[i][j]);
}
else
{
continue;
}
}
printf("\n");
}
return 0;
}
jungol 169
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
char arr[3][5];
char n[3];
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 5; j++)
{
scanf("%s", &n[0]);
arr[i][j] = (int)n[0] + 32;
}
}
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 5; j++)
{
printf("%c ", arr[i][j]);
}
printf("\n");
}
return 0;
}
jungol 170
#include <stdio.h>
void j_170_1(void)
{
printf("@@@@@@@@@@\n");
}
int main(void)
{
printf("first\n");
j_170_1();
printf("second\n");
j_170_1();
printf("third\n");
j_170_1();
return 0;
}
반응형
'Algorithm > JUNGOL' 카테고리의 다른 글
C언어, JUNGOL 571 ~ 580 (2) | 2023.11.21 |
---|---|
C언어, JUNGOL 9071 ~ 9080 (2) | 2023.11.20 |
C언어, JUNGOL 561 ~ 570 (0) | 2023.11.18 |
C언어, JUNGOL 9061 ~ 9070 (0) | 2023.11.17 |
C언어, JUNGOL 151 ~ 160 (0) | 2023.11.16 |