打印100~200 之间的素数,输出乘法口诀表,判断1000年---2000年之间的闰年
2016-03-16 22:30
537 查看
1.打印100~200 之间的素数
#include <stdio.h>
int main()
{
int n,i;
for(i=100;i<=200;i=i++)
{
for(n=2;n<=i-1;n++)
{
if(i%n==0)
break;
}
if(n>i-1)
printf("%d ",i);
}
printf("\n");
return 0;
}
2.输出乘法口诀表
#include<stdio.h>
int main()
{
int i,j;
for(i=1;i<=9;i++)
{
for(j=1;j<=i;j++)
printf("%d*%d=%d ",i,j,i*j);
printf("\n");
}
return 0();
}
3.
判断1000年---2000年之间的闰年
#include <stdio.h>
int main()
{
int count = 0;
int year = 0;
For (year = 1000;year <=2000;year++)
{
If (year % 4 == 0)
{
If (year % 100 != 0)
{
printf( "%d ",year);
count++;
}
}
if(year % 400 == 0)
{
printf( "%d ",year);
count++;
}
}
printf( "\ncount = %d\n",count);
return 0;
}
#include <stdio.h>
int main()
{
int n,i;
for(i=100;i<=200;i=i++)
{
for(n=2;n<=i-1;n++)
{
if(i%n==0)
break;
}
if(n>i-1)
printf("%d ",i);
}
printf("\n");
return 0;
}
2.输出乘法口诀表
#include<stdio.h>
int main()
{
int i,j;
for(i=1;i<=9;i++)
{
for(j=1;j<=i;j++)
printf("%d*%d=%d ",i,j,i*j);
printf("\n");
}
return 0();
}
3.
判断1000年---2000年之间的闰年
#include <stdio.h>
int main()
{
int count = 0;
int year = 0;
For (year = 1000;year <=2000;year++)
{
If (year % 4 == 0)
{
If (year % 100 != 0)
{
printf( "%d ",year);
count++;
}
}
if(year % 400 == 0)
{
printf( "%d ",year);
count++;
}
}
printf( "\ncount = %d\n",count);
return 0;
}
相关文章推荐
- 求字符串的最长回文子串
- mysql 日期处理及格式化
- java如何利用反射机制调用类的私有方法
- 运行第一个Hadoop程序,WordCount
- OCI释放句柄时应注意的问题
- HBase源码分析之Region定位
- iOS开发AssetsLibrary框架访问本地相册
- 模板方法模式
- Python 第五天 模块(2)
- 作业二:四则运算
- [置顶] eclipse android程序运行报错:Conversion to Dalvik format failed: Unable to execute dex:
- js里的事件传播--冒泡
- test/expr的使用
- codeforces 632C C The Smallest String Concatenation(背包)
- 【GUI设计】:实现脚掌压力实时显示功能
- 十一.增加数据修改功能
- SDUT 1400 马的走法(回溯法)
- shell中记录运行时间的一种方法
- FragmentPagerAdapter与FragmentStatePagerAdapter区别
- 运行Eclipse出错:Failed to load the JNI shared library