ylbtech-Arithmetic:Console-算法[for,while,dowhile]-读取7个数(1—50)的整数值,每读取一个值,程序打印出该值个数的* |
1.A,Demo(案例) |
【程序88】
题目:读取7个数(1—50)的整数值,每读取一个值,程序打印出该值个数的*。
1.程序分析:
1.B,Solution(解决方案) |
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int i, a, n=1; while (n <= 7) { do { a = Convert.ToInt32(Console.ReadLine()); } while (a < 1 || a > 50); for (i = 1; i <= a; i++) { Console.Write("*"); } Console.WriteLine(); n++; } } } }
1.C,Execution Result(运行结果) |
1 * 100 3 *** 9 ********* 50 ************************************************** 3 *** 3 *** 4 **** 请按任意键继续. . .