Initial commit: C language learning code

This commit is contained in:
2025-07-20 16:30:56 +08:00
commit 06e24173a6
139 changed files with 9303 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
int gcd(int x, int y) // 求最大公约数
{
int c;
while (y > 0)
{
c = x % y;
x = y;
y = c;
}
return x;
}
int main()
{
int m;
int n;
printf("请输入分式m/n:");
scanf("%d/%d", &m, &n);
int a, b;
int num_gcd = gcd(m, n);
a = m / num_gcd;
b = n / num_gcd;
printf("%d/%d的化简分式是%d/%d\n", m, n, a, b);
return 0;
}