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. 理解linux安装软件

    http://www.codecoffee.com/tipsforlinux/articles/27.html -------------------------------------------- ...

  2. apache zookeeper的安装

    original article:http://zookeeper.praveendeshmane.co.in/zookeeper/zookeeper-3-4-6-single-server-setu ...

  3. [Cypress] Create a Single Custom Cypress Command from Multiple Commands

    Cypress provides a straightforward API that allows you to define custom commands. In this lesson, we ...

  4. 关东升的《从零開始学Swift》即将出版

    大家好: 苹果2015WWDC大会公布了Swift2.0,它较之前的版本号Swift1.x有非常大的变化.所以我即将出版<从零開始学Swift><从零開始学Swift>将在&l ...

  5. 鸟哥的Linux私房菜-----8、文件系统的装载

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaGVrZXdhbmd6aQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQk ...

  6. poj3926

    dp+优化 很明显可以用单调队列优化. 记录下自己犯的sb错误:  数组开小,sum没搞清... #include<cstdio> #include<cstring> usin ...

  7. Check the difficulty of problems(概率+DP)

    http://poj.org/problem?id=2151 看的题解..表示没看懂状态转移方程.. #include<stdio.h> #include<string.h> ...

  8. windows php文件下载地址

    http://windows.php.net/downloads/releases/archives/

  9. linux下安装rabbitmq以及在spring中进行集成

    ### 一.安装erlang 1. yum install ncurses-devel 2. ./configure --prefix=/usr/local/erlang20 --without-ja ...

  10. KindEditor文本编辑框的实现

    效果图: kindeditor 是一个插件 下载地址: https://files-cdn.cnblogs.com/files/lxnlxn/kindeditor.zip 解压后将其放在项目的js文件 ...