您的位置:首页 > 其它

小练习——输出9*9乘法表,判断闰年

2016-07-27 17:20 260 查看
输出9*9乘法表

#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("输出9*9乘法表:\n");
int i = 1;
int j = 1;
for (i = 1; i <= 9; i++)
{
for (j = 1; j <= i; j++)
{
printf("%2d*%d=%2d ", i, j, i*j);
}
printf("\n");
}
system("pause");
return 0;
}


判断闰年:

#include<stdio.h>
#include<stdlib.h>
int main()
{
printf("请输入任一年份:\n");
int year=0;
scanf("%d",&year);
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
printf("yes!\n");//是闰年
else

a0e6
printf("no!\n");//不是闰年
system("pause");
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: