摘要: //输入一个100以内的整数,求1到这个整数的和 Console.WriteLine("请输入一个100以内的整数:"); int a=int.Parse(Console.ReadLine()); if (a 100) { Console.Wr... 阅读全文
posted @ 2016-05-04 22:02 枫炎 阅读(909) 评论(0) 推荐(0) 编辑
摘要: //百鸡百钱 公鸡2文,母鸡1文,小鸡0.5文 int count = 0; int gong = 0; while (gong<=50) { int mu = 0; while(mu<=100) ... 阅读全文
posted @ 2016-05-04 22:01 枫炎 阅读(729) 评论(0) 推荐(0) 编辑
摘要: for (; ; ) { Console.Write("请输入一个100以内的整数:"); int a = int.Parse(Console.ReadLine()); int sum = 0; ... 阅读全文
posted @ 2016-05-04 22:00 枫炎 阅读(247) 评论(0) 推荐(0) 编辑
摘要: //有1分钱,2分钱,5分钱的硬币,要组合出来2角钱,有几种组合方式,分别各多少个 int count = 0; for (int y = 0; y <= 20;y++ ) { for (int e = 0; e <= 10;e++ ) ... 阅读全文
posted @ 2016-05-04 21:59 枫炎 阅读(173) 评论(0) 推荐(0) 编辑
摘要: //大马驼2石粮食,中等马驼1石粮食,两头小马驼1石粮食, //要用100匹马,驼100石粮食,该如何分配? int count=0; for (int da = 0; da <= 50;da++ ) { for (int zhong = 0; zho... 阅读全文
posted @ 2016-05-04 21:57 枫炎 阅读(274) 评论(0) 推荐(0) 编辑
摘要: //while循环 for循环变形得到while循环 //初始条件拿到前面,循环状态改变放在循环体的最后一句 //for变成while,将原来的分号去掉,只留下循环体 //累加求和1-100 //纸张0.07毫米,折叠多少次能达到珠峰的高度8848米 int i =... 阅读全文
posted @ 2016-05-04 21:57 枫炎 阅读(1364) 评论(0) 推荐(0) 编辑
摘要: //五个小孩排成一队,问第一个多大了,第一个比第二个大两岁,以此类推,最后一个小朋友3岁了 //问第一个小孩的年龄 int a = 3; for (int i = 5; i >1;i-- ) { a += 2; } ... 阅读全文
posted @ 2016-05-04 21:54 枫炎 阅读(244) 评论(0) 推荐(0) 编辑
摘要: //百鸡百钱 ,公鸡2文钱一只,母鸡1文钱一只,小鸡半文钱一只 //共有100文钱,如何在凑够100只鸡的情况下刚好花完100文钱 int count = 0; int bian = 0; for (int gong = 0; gong <= 50;gong++ ) { ... 阅读全文
posted @ 2016-05-04 21:51 枫炎 阅读(262) 评论(0) 推荐(0) 编辑
摘要: //一张大纸0.07毫米厚,对折多少次能够达到珠峰的高度8848 int a = 0; for(int i=7;i<=884800000;a++) { i *= 2; } Console.WriteLine(a); 阅读全文
posted @ 2016-05-04 06:49 枫炎 阅读(603) 评论(0) 推荐(0) 编辑