Skip to content

Commit

Permalink
해달 채점 - c
Browse files Browse the repository at this point in the history
  • Loading branch information
looosemycoool committed Jun 8, 2024
1 parent bc860aa commit 69975d9
Show file tree
Hide file tree
Showing 27 changed files with 72 additions and 87 deletions.
20 changes: 9 additions & 11 deletions c/1.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,20 @@
#include <stdio.h>

int main() {
int num, re = 0;
int num, reversedNum = 0;


printf("입력\n");
scanf("%d", &num);


int len= 3;
while(num != 0) {
int ten = 1;
for(int i = 0; i < len-1 ; i++){
ten *= 10;
}
re += ten * (num % 10);
num /= 10;
len--;
while (num != 0) {
reversedNum = reversedNum * 10;
reversedNum = reversedNum + num % 10;
num = num / 10;
}
printf("출력\n%d", reversedNum);

printf("%d", re);

return 0;
}
Binary file modified c/1.exe
Binary file not shown.
Binary file modified c/1.out
Binary file not shown.
13 changes: 5 additions & 8 deletions c/2.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@

int main() {

int a=0;
int age;

scanf("%d", &a);
printf("나이를 입력하세요: ");
scanf("%d", &age);

if(a>=61){
if (age >= 61) {
printf("DISCOUNT\n");
printf("BOARD");
}

else{
printf("BOARD");
}
printf("BOARD\n");

return 0;
}
Binary file modified c/2.exe
Binary file not shown.
Binary file modified c/2.out
Binary file not shown.
17 changes: 8 additions & 9 deletions c/3.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
#include <stdio.h>

int main() {
int i=0;
int hour;

scanf("%d", &i);
printf("시간을 입력해주세요 (0-23): ");
scanf("%d", &hour);

if(i<12){
printf("AM");
}

else{
printf("PM");
}
if (hour < 12) {
printf("AM\n");
} else {
printf("PM\n");
}

return 0;
}
Binary file modified c/3.exe
Binary file not shown.
Binary file modified c/3.out
Binary file not shown.
36 changes: 14 additions & 22 deletions c/4.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,20 @@
#include <stdio.h>

int main() {
int i;

scanf("%d", &i);

if(i>=90 && i<=100){
printf("A");
}

else if(i<90 && i>=80){
printf("B");
}

else if(i<80 && i>=70){
printf("C");
}

else if(i<70 && i>=60){
printf("D");
int score;

scanf("%d", &score);

if (score >= 90) {
printf("A\n");
} else if (score >= 80) {
printf("B\n");
} else if (score >= 70) {
printf("C\n");
} else if (score >= 60) {
printf("D\n");
} else {
printf("F\n");
}
else{
printf("F");
}

return 0;
}
Binary file modified c/4.exe
Binary file not shown.
Binary file modified c/4.out
Binary file not shown.
15 changes: 6 additions & 9 deletions c/5.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@
#include <stdio.h>

int main() {
int age, height;
int age, height;

scanf("%d",&age);
scanf("%d",&height);
scanf("%d %d", &age, &height);

if(age>=14 || height>=160){
printf("X");
if (age >= 14 || height >= 160) {
printf("X\n");
} else {
printf("O\n");
}

else
{
printf("O");
}

return 0;
}
Binary file modified c/5.exe
Binary file not shown.
Binary file modified c/5.out
Binary file not shown.
16 changes: 9 additions & 7 deletions c/6.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@
#include <stdio.h>

int main() {
char c;
char ch;

scanf("%c", &c);
printf("Enter a character: ");
scanf(" %c", &ch);

if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u' ){
printf("O");

if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' ||
ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U') {
printf("O\n");
} else {
printf("X\n");
}

else{
printf("X");
}
return 0;
}
Binary file modified c/6.exe
Binary file not shown.
Binary file modified c/6.out
Binary file not shown.
26 changes: 9 additions & 17 deletions c/7.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,26 @@
int main() {
int year, month;


scanf("%d", &year);
scanf("%d", &month);
scanf("%d %d", &year, &month);


int isLeapYear = 0;
if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
isLeapYear = 1;
}
int isLeapYear = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);

switch (month) {
case 2:
if (isLeapYear) {
printf("29");
printf("29\n");
} else {
printf("28");
printf("28\n");
}
break;
case 4:
case 4:
case 6:
case 9:
case 11:
printf("30");
break;
default:
printf("31");
case 11:
printf("30\n");
break;
default:
printf("31\n");
}

return 0;
}
Binary file modified c/7.exe
Binary file not shown.
Binary file modified c/7.out
Binary file not shown.
15 changes: 11 additions & 4 deletions c/8.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,21 @@ int main() {

scanf("%d", &n);

for(int i = 1; i <= n; i++) {
sum += i;
factorial *= i;
for (int i = 1; i <= n; i++) {
sum += i;
factorial *= i;
}

if (n == 0) {
factorial = 1;
}

printf("%d\n", sum);
printf("%d", factorial);

for (int i = 2; i <= n; i++) {
printf(" * %d", i);
}
printf(")\n");

return 0;
}
Binary file modified c/8.exe
Binary file not shown.
Binary file modified c/8.out
Binary file not shown.
1 change: 1 addition & 0 deletions c/9.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ int main() {
} else {
printf("X\n");
}

}

}
Binary file modified c/9.exe
Binary file not shown.
Binary file modified c/9.out
Binary file not shown.

0 comments on commit 69975d9

Please sign in to comment.