for循环

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace for循环
{
class Program
{
static void Main(string[] args)
{
for (; ; )
{
//顺序,选择,循环
//for
//for (; ; )//死循环
//{

//}
//打印20遍你好
//for (int i = 1; i <= 20; i++)
//{
// if (i == 6)
// {
// continue;//结束本次循环,继续下次循环

// }

// Console.WriteLine(i);
//}
//输入一个整数,计算从1加到这个数的和
//Console.Write("请输入一个正整数:");
//int a = int.Parse(Console.ReadLine());
//int sum = 0;//0加上任何数都不会变化
//for (int i = 0; i <= a; i++)
//{
// sum += i;
//}
//Console.WriteLine(sum);

//Console.Write("请输入一个正整数:");
//int a = int.Parse(Console.ReadLine());
//int sum = 1;//0加上任何数都不会变化
//for (int i = 1; i <= a; i++)
//{
// sum *= i;
//}
//Console.WriteLine(sum);

//找出100以内的与7有关的数
//7的倍数
//个位数是7
//十位数是7

//int a = 0;
//for (double i = 1; i < 100; i++)
//{
// if (((i % 7) == 0) || (i / 10) == 7 || (i % 10) == 7)
// {
// Console.WriteLine(i);
// a ++;
// }

//}
//Console.WriteLine(a);

//一个游戏,前20关是每一关自身的分数
//21-30关,每一关是10分
//31-40关,每一关20分
//41-49关,每一关30分
//50关,是100分
//输入你现在闯到的关卡数,求你现在拥有的分数
//两种做法:if嵌套for for嵌套if

//Console.WriteLine("请输入闯到的关数:");
//int a = int.Parse(Console.ReadLine());
//int b = 0;
//if (a <= 50 && a > 0)
//{
// if (a == 50)
// {
// Console.Write("大神!您的");
// }
// else if (a > 40 && a < 50)
// {
// Console.Write("真厉害,您的");
// }
// else if (a < 41 && a > 30)
// {
// Console.Write("成绩一般,");
// }
// else if (a < 31 && a > 20)
// {
// Console.Write("请继续努力,");
// }
// else
// {
// Console.Write("啧啧啧,");
// }

// for (int i = 1; i < a; i++)
// {
// if (i <= 20)
// {
// b += i;
// }
// else if (i <= 30)
// {
// b += 10;
// }
// else if (i <= 40)
// {
// b += 20;
// }
// else if (i <= 49)
// {
// b += 30;
// }
// else
// {
// b += 100;
// }
// }
// Console.WriteLine("得分为" + b);
//}
//else
//{
// Console.WriteLine("您输入的有误");
//}

Console.Write("请输入您的阶梯数:");
int a = int.Parse(Console.ReadLine());
int b = 0;
if (a >= 0 && a <= 100)
{
if (a < 50)
{

for (int i = 0; i <= a; i++)
{
b += i;
}
}
else
{
b = 1125;
for (int i = 0; i <= (a - 49); i++)
{
b += 10;
}
}
Console.WriteLine("您的得分为:"+b);

}
else
{
Console.WriteLine("您输入的有误");
}

Console.WriteLine();
}
}
}
}

C#第六节课的更多相关文章

  1. centos shell脚本编程2 if 判断 case判断 shell脚本中的循环 for while shell中的函数 break continue test 命令 第三十六节课

    centos  shell脚本编程2 if 判断  case判断   shell脚本中的循环  for   while   shell中的函数  break  continue  test 命令   ...

  2. centos linux系统日常管理3 服务管理ntsysv,chkconfig,系统日志rsyslog,last ,lastb ,exec,xargs,dmesg,screen,nohup,curl,ping ,telnet,traceroute ,dig ,nc,nmap,host,nethogs 第十六节课

    centos linux系统日常管理3  服务管理ntsysv,chkconfig,系统日志rsyslog,last ,lastb ,exec,xargs,dmesg,screen,nohup,cur ...

  3. 风炫安全web安全学习第三十六节课-15种上传漏洞讲解(一)

    风炫安全web安全学习第三十六节课 15种上传漏洞讲解(一) 文件上传漏洞 0x01 漏洞描述和原理 文件上传漏洞可以说是日常渗透测试用得最多的一个漏洞,因为用它获得服务器权限最快最直接.但是想真正把 ...

  4. 风炫安全WEB安全学习第二十六节课 XSS常见绕过防御技巧

    风炫安全WEB安全学习第二十六节课 XSS常见绕过防御技巧 XSS绕过-过滤-编码 核心思想 后台过滤了特殊字符,比如说

  5. 风炫安全Web安全学习第十六节课 高权限sql注入getshell

    风炫安全Web安全学习第十六节课 高权限sql注入getshell sql高权限getshell 前提条件: 需要知道目标网站绝对路径 目录具有写的权限 需要当前数据库用户开启了secure_file ...

  6. 《linux就该这么学》第十六节课:第16,17章,Squid服务和iscsi网络存储

    第十六章 squid总结: 正向代理:yum  安装后清空防火墙即可正常使用,客户端设置浏览器 透明正向代理:vim  /etc/squid/squid.conf 59行:http_port  312 ...

  7. html第六节课

    JavaScript 一.JavaScript简介 1.JavaScript是个什么东西? 它是个脚本语言,需要有宿主文件,它的宿主文件是HTML文件. 2.它与Java什么关系? 没有什么直接的联系 ...

  8. Linux第六节课学习笔记

    if条件测试语句可以让脚本根据实际情况自动执行相应的命令,可以分为单分支.双分支与多分支. /dev/null为无回收功能的垃圾箱. read是用来读取用户输入信息的命令,-p用来显示提示信息. fo ...

  9. php第二十六节课

    会话购物车 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w ...

  10. php第十六节课

    分页 <?php /** file: page.class.php 完美分页类 Page */ class Page { private $total; //数据表中总记录数 private $ ...

随机推荐

  1. Machine_learning--score

    辛苦了2个半月,终须学完了machine-learning watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY2hyaXN0cHJpbmNlMDA3/font ...

  2. linux 获取经过N层Nginx转发的访问来源真实IP

    linux 获取经过N层Nginx转发的访问来源真实IP 学习:http://blog.csdn.net/zhenzhendeblog/article/details/49702575 学习:http ...

  3. android weight(权重)的详细分析

    首先要明确权重分配的是那些空间? 权重是依照比例分配屏幕的剩余空间 对这句话不理解的能够看下图 假如我们希望剩余的空间平分给空间1 和空间2 , 我们分别在2个控件的设置android:layout_ ...

  4. nginx启动访问

    修改配置文件后,查看配置是否ok 以下是有错误的 以下是ok的 nginx/sbin/nginx -t 启动查询: /usr/local/nginx/sbin/nginx -c /usr/local/ ...

  5. B3109 [cqoi2013]新数独 搜索dfs

    就是基于普通数独上的一点变形,然后就没什么了,普通数独就是进行一边dfs就行了. 题干: 题目描述 输入格式 输入一共15行,包含一个新数独的实例.第奇数行包含左右方向的符号(<和>),第 ...

  6. bzoj 1059 [ ZJOI 2007 ] 矩阵游戏 —— 二分图匹配

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1059 每一列选出一个占据一行才可以: 挫败. 代码如下: #include<iostr ...

  7. Blue Jeans(串)

    http://poj.org/problem?id=3080 寻找最长公共子串..暴搜的.. #include<stdio.h> #include<string.h> int ...

  8. php 图片生成器

    一.需求 最近公司由于有大量的海报要做,而且海报的布局规模都是一样的,只是内容不同,所以老板想我开发一个图片的生成器.可以根据你输入的内容生成海报图片. 具体有需求有以下的需求 1.可以根据将每条数据 ...

  9. CAS配置(2)之主配置

    WEB-INF目录 1.cas.properties文件(打开关闭SSL,主题,定制页面设置) #默认端口配置 #server.name=http://localhost:8080server.nam ...

  10. [Luogu2324]八数码难题

    抱歉...我可能真的做搜索上瘾了... 还是IDA*,自己看看就好了... 注意一下搜索顺序 #include<cstdio> #include<queue> #include ...