标签:for turn main lse include pre ret std amp
//打印闰年
#include <stdio.h>
int main()
{
int year = 0;
int count = 0;
for (year = 1000;year <= 2000;year++)
{
if (year%4==0 && year%100!=0)
{
printf("%d ", year);
count++;
}
else if (year % 400 == 0)
{
printf("%d ", year);
count++;
}
}
printf("\ncount=%d\n ",count);
return 0;
}
//打印素数
#include <stdio.h>
int main()
{
int i = 0;
int j = 0;
int count = 0;
for (i=100;i<=200;i++)
{
for (j = 2;j < i;j++)
{
if (i%j == 0)
break;
}
if (j == i)
{
count++;
printf("%d ",i);
}
}
printf("\ncount=%d\n ",count);
return 0;
}
//
标签:for turn main lse include pre ret std amp
原文地址:https://blog.51cto.com/15057883/2564544