1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-27 08:26:20 +00:00

增加 25e3fb1d 的 C 语言代码

This commit is contained in:
Baoshuo Ren 2024-10-11 18:23:08 +08:00
parent 25e3fb1d7c
commit 1e0c23a743
Failed to extract signature
4 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,9 @@
#include <stdio.h>
int main() {
printf("I'm gonna WIN!\n");
printf("I'm gonna WIN!\n");
printf("I'm gonna WIN!\n");
return 0;
}

View File

@ -0,0 +1,12 @@
#include <stdio.h>
int main() {
int math = 87;
int eng = 72;
int comp = 93;
int average = (math + eng + comp) / 3;
printf("math = %d, eng = %d, comp = %d, average = %d\n", math, eng, comp, average);
return 0;
}

View File

@ -0,0 +1,12 @@
#include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
printf("C = %d\n", (a + b) * 2);
printf("S = %d\n", a * b);
return 0;
}

View File

@ -0,0 +1,21 @@
#include <stdio.h>
int max(int a, int b, int c) {
if (a > b && a > c) {
return a;
} else if (b > a && b > c) {
return b;
} else { // c > a && c > b
return c;
}
}
int main() {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
printf("%d\n", max(a, b, c));
return 0;
}