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. 【HDOJ】3029 Scales

    CF上有道类似的,做了那个这个简单多了.思路是取模.模等于1如何处理,模等于2如何分类分类讨论后.可解.解得对数据排序后再输出. /* 3029 */ #include <iostream> ...

  2. BZOJ1232: [Usaco2008Nov]安慰奶牛cheer

    1232: [Usaco2008Nov]安慰奶牛cheer Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 578  Solved: 403[Submi ...

  3. 查找IP来源

    通过调用淘宝IP库获取IP归属地,脚本如下: #!/usr/bin/env python # -*- coding: utf-8 -*- import urllib import json impor ...

  4. VS 2010不显示头文件源文件和所有以前分类的文件夹,*.h 和*.cpp都显示在同一个文件

    打开VS后不显示头文件源文件和所有以前分类的文件夹,*.h 和*.cpp都显示在同一个文件 点击右图红色指示显示所有文件夹按钮,就能恢复.

  5. HTML-通过点击网页上的文字弹出QQ添加好友页面

    在网上参考了部分方法,综合了一下. 发现有2中方式: 第一种是不能直接弹出添加界面的,只能弹出网页,再通过网页中的添加好友才能添加: 弹出的网页是这样的(我是写成在新的网页中打开) 现在看实现的代码: ...

  6. CSU 1505 酷酷的单词 湖南省赛第十届题目

    题目链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1505 题意:技巧题,就是一行字符串中,每个字母出现的次数互不相同,复即为酷的单词. 解题 ...

  7. SRM 440(1-250pt, 1-500pt)

    DIV1 250pt 题意:小球从一段折线斜坡上滚下来,告诉所用时间,求重力加速度. 解法:二分答案模拟即可. tag:二分,simulation // BEGIN CUT HERE /* * Aut ...

  8. crawler4j:轻量级多线程网络爬虫

    crawler4j是Java实现的开源网络爬虫.提供了简单易用的接口,可以在几分钟内创建一个多线程网络爬虫. 安装 使用Maven 使用最新版本的crawler4j,在pom.xml中添加如下片段: ...

  9. hdoj 2141 Can you find it?【二分查找+暴力】

    Can you find it? Time Limit: 10000/3000 MS (Java/Others)    Memory Limit: 32768/10000 K (Java/Others ...

  10. [置顶] [MATLAB技术贴]漫谈MATLAB矩阵转置

    矩阵转置是matlab最基本的操作了,但这个基本操作,也是很多初学者容易出现问题的地方.本帖通过几个实例演示matlab矩阵转置的操作. 方法一:'  运算符与  .'  运算符 >>a ...