作业一:
#include<stdio.h>
int main()
{
int i, j, k, cnt = 0;
for (i = 0; i <= 10; i ++)
for (j = 0; j <= 10; j += 2)
for (k = 0; k <= 10; k +=5)
if (i + j + k == 10)
cnt ++;
printf("%d\n", cnt);
}
作业二:
#include <stdio.h>
int main ()
{
int m, n, p, tmp;
printf ("请输入两个整数:\n");
scanf ("%i %i", &m, &n);
p=m*n;
while (n!=0){
tmp=m%n;
m=n;
n=tmp;
}
printf ("最大公约数 %i\n", p/m);
return 0;
}