2014年10月16号--for语句实例
Console.WriteLine("一对小兔一个月之后长成大兔,再过一个月后生新的一对兔子,且两年之后有多少对兔子,就是三兔子幼兔,小兔,成兔");
Console.WriteLine("输入几月份");
int s=int.Parse(Console.ReadLine());
int x=0,c=0,y=1;
for (int a =1; a <=s/*12*/;a++ )/*在这里也可以把上面的s去掉,*/
{
if (a == 1)
{
c = 0;
x = 0;
y = 1;
}
else
{
c = c + x;
x=y;
y = c;
}
//Console.WriteLine("当{0}个月时,生产了{1}对成兔,{2}对小兔,{3}对幼兔,共生产了{4}对兔子",s,c,x,y,x+y+c);
////这样是按一下出一个月的,当输入为4月时候,写上4,按一下,出一个月的,按一下出一个月的,直到显示出4月为止
//Console.ReadKey();
}
Console.WriteLine("当{0}个月时,生产了{1}对成兔,{2}对小兔,{3}对幼兔,共生产了{4}对兔子", s, c, x, y, x + y + c);
//其实这里
Console.ReadKey();
}
}
}
////反直角三角形
//Console.WriteLine("请输入一个数字");
//int a = int.Parse(Console.ReadLine());
//for (int i = 1; i <=a; i++)
//{
// for (int s = 1; s <=(a - i); s++)
// {
// Console.Write(" ");
// }
// for (int w = 0; w < i; w++)
// { // Console.Write("☆");
// }
// Console.Write("\n");
//}
//Console.ReadLine();
////等腰三角形
//Console.WriteLine("请输入一个数字");
//int a = int.Parse(Console.ReadLine());
//for (int i = 0; i < a; i++)
//{
// for (int s = 0; s <(a - i); s++)
// { // Console.Write(" ");
// }
// for (int w = 0; w <=i; w++)
// { // Console.Write("☆");
// }
// Console.Write("\n");
//}
//Console.ReadLine();
////反直角三角形
//Console.WriteLine("请输入一个数字");
//int a = int.Parse(Console.ReadLine());
//for (int i = 0; i <= a; i++)
//{
// for (int s =0; s <=(a-i); s++)
// { // Console.Write("☆");
// }
// Console.Write("\n");
//}
//Console.ReadLine();
////打印等腰直角三角型
//Console.WriteLine("请输入一个数"); //int a = int.Parse(Console.ReadLine());
//for (int i =0; i <a ; i++)
//{
// for (int s = 0; s <= i;s++ )
// {
// Console.Write("☆"); // }
// Console.Write("\n");
//}
//Console.ReadLine();
// //求阶乘
// int s=1;
// Console.WriteLine("求一个阶乘,下面请输入一个数");
// int a = int.Parse(Console.ReadLine());
// for (int i = 1; i <=a;i++)
// {
// s = s * i;
// if(i==a)
// {
// Console.WriteLine("输出的阶乘为{0}",s);
// }
// }
// Console.ReadKey();
//Console.Write("输入弹起的次数");
//int n = int.Parse(Console.ReadLine());
//double h=10;
//for (int i = 1; i <=n; i++)
//{
// h *= 3 / 4.0;
// Console.WriteLine("第{0}次弹起的高度为{1}",i,h);
//}
//Console.ReadLine();
// Console.WriteLine("请输入个数");
// int n = int.Parse(Console.ReadLine());
// for(int i=1;i<=n;i++)
////爬阶梯,100级阶梯,爬的0-50级每一级赋予同样的分,以后每级十分,输入爬的阶数,得出分数1+2+3+4,,,
//int s = 0, i;
//Console.WriteLine("输入你爬的阶数");
//int j = int.Parse(Console.ReadLine());
//for (int c = 1; c <= j; c++)
//{
// if (c <= 50)
// {
// s += c;
// }
// else
// {
// s += 10;
// } //}
//Console.WriteLine("得出的分数为:" + s);
//Console.ReadLine();
//if (j <= 50 && j > 0)
//{
// for (i = 1; i <= j; i++)
// {
// s = s + i;
// if (i == j)
// {
// Console.WriteLine("爬阶梯得分为输出的分数为{0}", s);
// }
// } //} //else if (j <= 100 && j > 50)
//{ // int k = (50 + 1) * 25;
// Console.WriteLine("爬阶梯得分为输出的分数为{0}", (((j - 50) * 10) + k)); //}
//else
//{
// Console.WriteLine("你输入的不对");
//}
//Console.ReadLine();
////输出一个数a,求1到a的数的和
//int s=0,i ;
//Console.WriteLine("输入一个数");
//int a = int.Parse(Console.ReadLine());
//for ( i = 1; i <= a; i++)
//{
// s = s + i;
//if(i==a)
// {
//Console.WriteLine("输出的和为{0}", s);
// }
//} //Console.ReadKey();
循环嵌套:for
////菱形的程序
//Console.WriteLine("请输入一个数字");
//int a = int.Parse(Console.ReadLine());
////菱形的上半部分
//for (int i = 1; i <=a; i++)
//{
// for (int s = 1; s <=(a - i); s++)
// { // Console.Write(" ");
// }
// for (int w = 1; w <=(2*i-1); w++)
// { // Console.Write("☆");
// }
// Console.Write("\n");
//}
////菱形下半部分
//for (int o = 1; o <= a; o++)
//{
// for (int g = 1; g <= o; g++)
// { // Console.Write(" ");
// }
// for (int e = 1; e <= ((a-o)*2 - 1); e++)
// { // Console.Write("☆");
// }
// Console.Write("\n");
//}
//Console.ReadLine(); ////一:反直角三角形,右下边
//Console.WriteLine("请输入一个数字");
//int a = int.Parse(Console.ReadLine());
//for (int i = 1; i <= a; i++)
//{
// for (int s = 1; s <= (a - i); s++)
// {
// Console.Write(" ");
// }
// for (int w = 0; w < i; w++)
// { // Console.Write("☆");
// }
// Console.Write("\n");
//}
//Console.ReadLine(); ////二:反三角形,左上
//Console.WriteLine("请输入一个数");
//int n = int.Parse(Console.ReadLine()); //for (int i = n; i >= 1; i--)
//{
// for (int a = 1; a <= i; a++)
// {
// Console.Write("☆");
// }
// Console.Write("\n");
//}
//Console.ReadLine(); ////反直角三角形,,左上
//Console.WriteLine("请输入一个数字");
//int a = int.Parse(Console.ReadLine());
//for (int i = 0; i <= a; i++)
//{
// for (int s = 0; s <= (a - i); s++)
// { // Console.Write("☆");
// }
// Console.Write("\n");
//}
//Console.ReadLine(); ////三:打印等腰直角三角型,左下
//Console.WriteLine("请输入一个数"); //int a = int.Parse(Console.ReadLine());
//for (int i = 0; i < a; i++)
//{
// for (int s = 0; s <= i; s++)
// {
// Console.Write("☆"); // }
// Console.Write("\n");
//}
//Console.ReadLine(); // //四:反三角形,右上
// Console.WriteLine("请输入一个数"); // int a = int.Parse(Console.ReadLine()); // for (int i = 0; i <= a; i++)
// {
// for (int s = 1; s <= i; s++)
// {
// Console.Write(" ");
// }
// for (int w = 0; w <=a-i-1; w++)
// {
// Console.Write("☆");
// }
// Console.Write("\n");
//}
// Console.ReadLine(); // //求阶乘
// int s=1;
// Console.WriteLine("求一个阶乘,下面请输入一个数");
// int a = int.Parse(Console.ReadLine());
// for (int i = 1; i <=a;i++)
// {
// s = s * i;
// if(i==a)
// {
// Console.WriteLine("输出的阶乘为{0}",s);
// }
// }
// Console.ReadKey(); ////等腰三角形
//Console.WriteLine("请输入一个数字");
//int a = int.Parse(Console.ReadLine());
//for (int i = 0; i < a; i++)
//{
// for (int s = 0; s <(a - i); s++)
// { // Console.Write(" ");
// }
// for (int w = 0; w <=i; w++)
// { // Console.Write("☆");
// }
// Console.Write("\n");
//}
//Console.ReadLine(); //Console.WriteLine("一对小兔一个月之后长成大兔,再过一个月后生新的一对兔子,且两年之后有多少对兔子,就是三兔子幼兔,小兔,成兔");
//Console.WriteLine("输入几月份");
// int s=int.Parse(Console.ReadLine());
// int x=0,c=0,y=1;
// for (int a =1; a <=s/*12*/;a++ )/*在这里也可以把上面的s去掉,写上12*/
// {
// if (a == 1)
// {
// c = 0;
// x = 0;
// y = 1;
// }
// else
// {
// c = c + x;
// x=y;
// y = c;
// } // //Console.WriteLine("当{0}个月时,生产了{1}对成兔,{2}对小兔,{3}对幼兔,共生产了{4}对兔子",s,c,x,y,x+y+c);
// ////这样是按一下出一个月的,当输入为4月时候,写上4,按一下,出一个月的,按一下出一个月的,直到显示出4月为止
// //Console.ReadKey();
// }
// Console.WriteLine("当{0}个月时,生产了{1}对成兔,{2}对小兔,{3}对幼兔,共生产了{4}对兔子", s, c, x, y, x + y + c);
// //在这里只是输出一行,并不会产生上面的效果
// Console.ReadKey(); ////最初幼兔5对,小兔2对,成兔3对,每过三个月幼兔长小兔,成兔生小兔,再过三个月小兔长成兔
//Console.WriteLine("输入过了几个月");
//int shijian=int.Parse(Console.ReadLine());
//int y = 5, x = 2, c = 3;
//for(int a=1;a<=shijian;a+=3)
//{
//if(a==1)
//{
// y = 5;
// x = 2;
// c = 3;
//}
//else
//{
// c = c + x;
// x = y;
// y = c;
//}
////Console.WriteLine("当{0}个月时,生产了{1}对成兔,{2}对小兔,{3}对幼兔,共生产了{4}对兔子", shijian, c, x, y, x + y + c);
////Console.ReadKey();
//}
//Console.WriteLine("当{0}个月时,生产了{1}对成兔,{2}对小兔,{3}对幼兔,共生产了{4}对兔子", shijian, c, x, y, x + y + c);
//Console.ReadKey(); //Console.WriteLine("请输入一个数的阶乘的和");
//Console.WriteLine("请输入一个数");
//double n = double.Parse(Console.ReadLine());
//int b = 1, s = 0,a=1;
//for (int i =1; i <= n; i++)
//{
// b = b * i;
// s = s + b;
//}
//Console.WriteLine("阶乘的和为{0}", s);
//Console.ReadLine();
2014年10月16号--for语句实例的更多相关文章
- 系列文章:老项目的#iPhone6与iPhone6Plus适配#(持续更新中,更新日期2014年10月12日 星期日 )
本文永久地址为http://www.cnblogs.com/ChenYilong/p/4020399.html ,转载请注明出处. ********************************** ...
- 2016年10月16日 星期日 --出埃及记 Exodus 18:27
2016年10月16日 星期日 --出埃及记 Exodus 18:27 Then Moses sent his father-in-law on his way, and Jethro returne ...
- 2014年5月16至24日,杨学明老师为深圳创维RGB事业部提供两天的《软件测试管理》内训服务!
2014年5月16日和24日,<在软件开发流程中构筑软件质量—软件测试管理>内训课程在深圳创维集团成功举办!来自创维研发.测试.生产等部门的管理人员和核心骨干等参加了此次培训,此次培训由研 ...
- 2019第一期《python测试开发》课程,10月13号开学
2019第一期<python测试开发>课程,10月13号开学! 主讲老师:上海-悠悠 上课方式:QQ群视频在线教学,方便交流 本期上课时间:10月13号-12月8号,每周六.周日晚上20: ...
- Java分布式互联网架构/微服务/高性能/springboot/springcloud2018年10月16日直播内容
2018年10月16日直播内容 架构师揭秘springboot对springmvc的自动配置原理 直播地址:https://ke.qq.com/course/179440?tuin=9b386640 ...
- Elasticsearch 2014年10月简报
1. Elasticsearch Updates 1.1 公布了Kibana 4 Beta 1 和Beta 1.1 Kibana 4不管是在界面的布局,使用配置方法,还是底层绘制图表的方式都与Kiba ...
- 10月12号 晚八点 Speed-BI 云平台-基于Excel数据源的管理驾驶舱构建全过程,腾讯课堂开课啦
认真地做了一大摞一大摞的报表,老板没时间看?努力把能反馈的内容都融汇进图表里,老板嫌复杂?做了几个简单的报表,老板一眼就觉得信息不全面?每个报表都用了各种各样的图表,老板却毫无兴趣?明明很努力了,为什 ...
- Java程序设计第四次作业内容 第五次作业10月9号发布,为第三章全部例题
第六题:使用判断语句,根据数字,输出对应的中文是星期几? 直接使用一个if语句的情况 int weekDay=3; if(weekDay==1){ sop("今天是星期一"); } ...
- SE 2014年4月16日
一. 描述BGP路由协议中 BGP路由携带 AS-PATH/ next-hop / ORIGIN / local-preference 属性的特点! BGP协议中的AS-PATH是AS列表,用来 ...
随机推荐
- Mysql、SqlServer和Oracle 添加、修改、删除 字段总结
MySql: 1.添加 添加单列: ALTER TABLE 表名 ADD 列名 数据类型 添加多列: ALTER TABLE 表名 ADD 列名1 数据类型1,Add 列名2 数据类型2 2.修改 修 ...
- Bluetooth LE(低功耗蓝牙) - 第二部分
回顾 在前面的文章中我们介绍了Bluetooth LE的背景也说明了我们在本系列文章中将要开发什么,但是还没有实际的代码.我们将在这篇文章中纠正这一点,我们将通过定义 Service/Activity ...
- openwrt使用3G上网卡
尊敬的大大.感谢你抽空指导我 我的设备是db120 mu350 和广东无限卡 版本是OpenWrt Backfire 10.03.336 DIY full 一. 没有安装到kmod-us ...
- nginx -- 安装配置Nginx
安装说明 系统环境:CentOS-6.3 软件:nginx-1.2.6.tar.gz 安装方式:源码编译安装 安装位置:/usr/local/nginx 下载地址:http://nginx.org ...
- Maven学习(3) - Maven和Eclipse集成和构建多模块Maven项目
最近在工作中越来越经常的用到了Maven作为项目管理和Jar包管理和构建的工具,感觉Maven的确是很好用的.而且要将Maven的功能最大发挥出来,多模块是一个很好的集成例子. 一个Maven项目包括 ...
- (转载)linux中shell变量
(转载)http://blog.csdn.net/zahuopuboss/article/details/8633891 为使shell编程更有效,系统提供了一些shell变量.shell变量可以保存 ...
- App被拒绝的原因收录
转自:dApps开发者 » APP被苹果App Store拒绝的79个原因(未完待续) 1.程序有重大bug,程序不能启动,或者中途退出.2.绕过苹果的付费渠道,我们之前游戏里的用兑换码兑换金币.3. ...
- Goole音乐搜索
本博文的主要内容有 .Goole音乐搜索的介绍 1.Goole音乐搜索的介绍 https://zh.wikipedia.org/wiki/%E8%B0%B7%E6%AD%8C%E9%9F%B3% ...
- linux OpenOffice
1.下载所需的安装包 /project/openofficeorg.mirror/4.0.1/binaries/zh-CN/Apache_OpenOffice_4.0.1_Linux_x86-64_ ...
- 355. Design Twitter
二刷尝试了别的办法,用MAP代表关注列表. 然后不初始化,但是只要有用户被使用,而他又不在MAP里,就把他加进去,然后让他关注自己.. 但是这样做超时了. 问题在于这个题解法太多,有很多不同的情况. ...