// See aka.ms/new-console… for more information Console.WriteLine("Hello, World!"); /* while(循环判断的条件){ 循环体
}
*/
//Console.WriteLine(""); /*int i = 1; while (i < 10) {
Console.WriteLine(i); //打印1--9,循环9次
i++;
} int j = 10; while (j>0) { j--; Console.WriteLine(j); } int x = Convert.ToInt32(Console.ReadLine()); int y = 0; while (x>0) {
y += x;
x--;
} Console.WriteLine(y);*/ /*int x = 100; int y; while (x>0) { if (x % 2 == 0) { Console.WriteLine(x);
}
x--;
}/ ///shu输入次数 int x = Convert.ToInt32(Console.ReadLine()); int y=0; while (x != 1) { if (x % 2 == 0) {
x = x / 2;
}
else if (x % 2 == 1)
{
x = 3 * x + 1;
}
y++;
} Console.WriteLine(y);*/ /*int x = Convert.ToInt32(Console.ReadLine()); //double num = 10; int y = 0; double average1; int c1 =x;
//Console.WriteLine(num.ToString("0.000")); //保留3位小数
while (x>0) { y += Convert.ToInt32(Console.ReadLine()); ;
x--;
} // 一个整数* 一个浮点数 结果就是一个浮点数; average1 = y / c1; Console.WriteLine(average1.ToString("0.000"));*/
/* for(初始值;表达式;增亮表达式) { 循环体
} //死循环 for(;;){}
*/ /int i= 1; int y = 0; for (;i<10;i++) { //break 结束循环 continue 跳出当前这一次循环继续进入下一次循环 Console.WriteLine(i); continue; y++; } Console.WriteLine(i); Console.WriteLine(y);/
/*int x = Convert.ToInt32(Console.ReadLine()); int y = Convert.ToInt32(Console.ReadLine()); int z = 0; if (x > y) { while (y <= x) { if (y % 17 == 0) {
z += y;
}
y++;
}
} if (x < y) { while (x <= y) { if (x % 17 == 0) {
z += x;
}
x++;
}
} Console.WriteLine(z); / / int num1 = 0; do{//不管循环是否为真,一定会执行一次 Console.WriteLine(num1); num1++; }while(num1 <10);
注意;先运行do里面的再运行while */
/* int a = Convert.ToInt32(Console.ReadLine()); int n = Convert.ToInt32(Console.ReadLine()); do { a *= a; --n; } while (n > 0); Console.WriteLine(a);
*/
/* double x = Convert.ToInt32(Console.ReadLine()); double y = 0; for (int i = 0; i < 10; i++) { x = x/2; Console.WriteLine(x); y += x *3; } Console.WriteLine(x); Console.WriteLine(y); */