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语句实例的更多相关文章

  1. 系列文章:老项目的#iPhone6与iPhone6Plus适配#(持续更新中,更新日期2014年10月12日 星期日 )

    本文永久地址为http://www.cnblogs.com/ChenYilong/p/4020399.html ,转载请注明出处. ********************************** ...

  2. 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 ...

  3. 2014年5月16至24日,杨学明老师为深圳创维RGB事业部提供两天的《软件测试管理》内训服务!

    2014年5月16日和24日,<在软件开发流程中构筑软件质量—软件测试管理>内训课程在深圳创维集团成功举办!来自创维研发.测试.生产等部门的管理人员和核心骨干等参加了此次培训,此次培训由研 ...

  4. 2019第一期《python测试开发》课程,10月13号开学

    2019第一期<python测试开发>课程,10月13号开学! 主讲老师:上海-悠悠 上课方式:QQ群视频在线教学,方便交流 本期上课时间:10月13号-12月8号,每周六.周日晚上20: ...

  5. Java分布式互联网架构/微服务/高性能/springboot/springcloud2018年10月16日直播内容

    2018年10月16日直播内容 架构师揭秘springboot对springmvc的自动配置原理 直播地址:https://ke.qq.com/course/179440?tuin=9b386640 ...

  6. Elasticsearch 2014年10月简报

    1. Elasticsearch Updates 1.1 公布了Kibana 4 Beta 1 和Beta 1.1 Kibana 4不管是在界面的布局,使用配置方法,还是底层绘制图表的方式都与Kiba ...

  7. 10月12号 晚八点 Speed-BI 云平台-基于Excel数据源的管理驾驶舱构建全过程,腾讯课堂开课啦

    认真地做了一大摞一大摞的报表,老板没时间看?努力把能反馈的内容都融汇进图表里,老板嫌复杂?做了几个简单的报表,老板一眼就觉得信息不全面?每个报表都用了各种各样的图表,老板却毫无兴趣?明明很努力了,为什 ...

  8. Java程序设计第四次作业内容 第五次作业10月9号发布,为第三章全部例题

    第六题:使用判断语句,根据数字,输出对应的中文是星期几? 直接使用一个if语句的情况 int weekDay=3; if(weekDay==1){ sop("今天是星期一"); } ...

  9. SE 2014年4月16日

    一. 描述BGP路由协议中  BGP路由携带 AS-PATH/ next-hop  / ORIGIN /  local-preference 属性的特点! BGP协议中的AS-PATH是AS列表,用来 ...

随机推荐

  1. AD域设置

    一.安装条件 · 安装者必须具有本地管理员权限 · 操作系统版本必须满足条件(windows server 2003 除WEB版外都满足) · 本地磁盘至少有一个NTFS文件系统 · 有TCP/IP设 ...

  2. Win32消息机制

    1. 消息机制     过程驱动:程序是按照我们预先定义好的顺序执行,每执行一步,下一步都已经按照预定的顺序继续执行,直到程序结束.       事件驱动:程序的执行顺序是无序的.某个时间点所执行的代 ...

  3. 游戏开发设计模式之原型模式 & unity3d JSON的使用(unity3d 示例实现)

    命令模式:游戏开发设计模式之命令模式(unity3d 示例实现) 对象池模式:游戏开发设计模式之对象池模式(unity3d 示例实现) 实现原型模式 原型模式带来的好处就是,想要构建生成任意独特对象的 ...

  4. 一个简单的GI--Reflective Shadow Maps

    Reflective Shadow Maps是一种简单的GI,虽然名字带有Shadow Maps,但是和Shadow Maps没有什么关系,是在screen space的一种方法,不像光线追踪和辐射度方 ...

  5. Performance Optimization (2)

    DesktopGood performance is critical to the success of many games. Below are some simple guidelines f ...

  6. HDOJ/HDU 2562 奇偶位互换(交换位置~)

    Problem Description 给定一个长度为偶数位的0,1字符串,请编程实现串的奇偶位互换. Input 输入包含多组测试数据: 输入的第一行是一个整数C,表示有C测试数据: 接下来是C组测 ...

  7. 一些收费的vpn或ssh代理

    www.expressvpn.com TorGuard:    https://help.ubuntu.com/community/Tor?action=show&redirect=TOR h ...

  8. poj 1847 Tram【spfa最短路】

    Tram Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 12005   Accepted: 4365 Description ...

  9. 使用ViewPager实现三个fragment切换

    新建一个android项目 先展示效果吧 首先看myfragmentPagerAdater这个类的代码 package com.example.viewpager; import java.util. ...

  10. uva10829 L-Gap Substrings

    题意 给出一个长度为\(n(\leqslant 50000)\)的字符串,求形如\(\mathrm{UVU}\)形式的字串,其中\(\mathrm{V}\)的长度给定. 题解 枚举\(\mathrm{ ...