100~200之间素数
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
int main()
{
int a, b, c = 0;//定义整型变量a,b,c并给c初始化赋值
for (a = 100; a <= 200; a++)//for循环体,a初始值100,a小于201,a自加1
{
for (b = 2; b < a; b++)//for循环体,b初始值2,b小于a,b自加1
{
if (a%b == 0)
break;//如果a能除余b,跳出循环
else
if (b == a - 1)
c = 1;
}
if (c == 1)
{
printf("%d\n", a);
c = 0;
system("pause");
}
}
}
输出乘法口诀表
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
int main()
{
{ int a, b;
for (a = 1; a <= 9; a++)
{
for (b = 1; b <= 9; b++)
printf("%d*%d=%d\n", a, b, a*b);
}
printf("\n");
system("pause");
}return 0;
}![在这里插入图片描述](https://www.icode9.com/i/ll/?i=201909231435182.png?,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyNjY0NjM2,size_16,color_FFFFFF,t_70)
1000~2000间闰年
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
int main()
{
int x;
for (x = 1000; x <= 2000; x++)
if (x % 400 == 0)
printf("%d\n是闰年", x);
else{
if (x % 100 != 0 && x % 4 == 0)
printf("%d是闰年", x);
}
system("pause");
printf("%d\n不是", x);}