1.
int main()
{
int i, j = 0;
for (i = 1;i <= 9;i++)
{
for (j = 1;j <= i;j++)
{
printf("%d*%d=%d\t", i, j, i * j);
}
printf("\n");
}
return 0;
}
int main()
{
int a, b,year,count = 0;
scanf("%d,%d", &a, &b);
for ( year = a;year <= b;year++)
{
//int count = 0;
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
{
count++;
}
//printf("years=%d\n", count);
}
printf("years=%d\n", count);
return 0;
}
2. int main()
{
int a, b = 0;
scanf("%d %d", &a, &b);//假如是12 18
int c = a % b;//12%18=12
int d = a * b;
//while (c != 0)
//{
// a = b;//1.a=18,
// b = c;//1.b=12,
// c = a % b;//1.c=18/12=6,
//}
//printf("%d\n", b);//b为公约数
int h = d / b;
printf("公约数= %d,公倍数=%d\n", b,h);
return 0;
2.1 int main()
{
int a, b = 0;
scanf("%d %d", &a, &b);//假如是12 18
//int c = a % b;//12%18=12
int c = b % a;
int d = a * b;
//while (c != 0)
//{
//a = b;//1.a=18,
// b = c;//1.b=12,
// c = a % b;//1.c=18/12=6,
//}
//printf("%d\n", b);//b为公约数
int h = d / c;
printf("公约数= %d,公倍数=%d\n", c, h);
return 0;
3.int main()
{
int i, j = 0;
for (i = 1;i <= 9;i++)
{
for (j = 1;j <= i;j++)
{
printf("%d*%d=%d\t", i, j, i * j);
}
printf("\n");
}
return 0;
}