作業(yè)一
#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);
}
作業(yè)二
#include <stdio.h>
int main ()
{
int m, n, p, tmp;
printf ("請輸入兩個整數(shù):\n");
scanf ("%i %i", &m, &n);
p=m*n;
while (n!=0){
tmp=m%n;
m=n;
n=tmp;
}
printf ("最大公約數(shù) %i\n", p/m);
return 0;
}