Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7주차\브론즈3\3 #17

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Soyoung/5-1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>

int factorial(int n) {
if( n==0 || n== 1 ) {
return 1;
}
else {
return n * factorial(n-1);
}
}

int main() {
int N;
scanf("%d", &N);
printf("%d", factorial(N));
return 0;
}
14 changes: 14 additions & 0 deletions Soyoung/5-2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <stdio.h>

char i_letter(char *S, int i) {
return S[i-1];
}

int main() {
char S[1000];
scanf("%s", S);
int i;
scanf("%d", &i);
printf("%c", i_letter(S, i));
return 0;
}
17 changes: 17 additions & 0 deletions Soyoung/5-3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>

int main() {
int T;
scanf("%d", &T);
for(int i=0;i<T;i++) {
char S[1000];
scanf("%s", S);

int j=0;
while(S[j] != '\0') {
j++;
}
printf("%c %c\n", S[0], S[j-1]);
}
return 0;
}
23 changes: 23 additions & 0 deletions Soyoung/7_1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <stdio.h>

int main() {
int N;
scanf("%d", &N);

int min = 1000000;
int max = -1000000;

for (int i = 0; i < N; i++) {
int num;
scanf("%d", &num);

if (num < min) {
min = num;
}
if (num > max) {
max = num;
}
}
printf("%d %d\n", min, max);
return 0;
}
21 changes: 21 additions & 0 deletions Soyoung/7_2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <stdio.h>

int main() {
while (1) {
int a, b;
scanf("%d %d", &a, &b);

if (a == 0 && b == 0) {
break;
}
if (b % a == 0) {
printf("factor\n");
} else if (a % b == 0) {
printf("multiple\n");
} else {
printf("neither\n");
}
}

return 0;
}
24 changes: 24 additions & 0 deletions Soyoung/7_3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <stdio.h>

int main() {
while(1) {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);

a *= a;
b *= b;
c *= c;

if(a == 0 && b == 0 && c == 0) {
break;
}
else if(((a + b) == c) || ((a + c) == b) || ((c + b) == a)) { //문제에서 c가 제일 큰 변이라는 보장이 없음
printf("right\n");
}
else {
printf("wrong\n");
}

}
return 0;
}
20 changes: 20 additions & 0 deletions Soyoung/C_study.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <stdio.h>

int main() {
int T;
scanf("%d", &T);
for(int t=0; t<T; t++) {
int a, b, result;
scanf("%d %d", &a, &b);

a = a % 10;
if (a == 0) {
result = 10;
}
else {
result = (a^((b % 4)+4)) % 10;
}
printf("%d\n", result);
}
return 0;
}
1 change: 1 addition & 0 deletions Soyoung/Summer_C_study
Submodule Summer_C_study added at 3d186f