Ввод данных - C# (190257)
Формулировка задачи:
внести изменения в программный код так, чтобы значения переменных i j вводились с клавиатуры.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int i = 5;
while (i > 0) { Console.WriteLine(i); --i; };
int j = 10;
do { Console.Write(j); --j; Console.Write(" "); } while (j > 0);
Console.Read();
}
}
}Решение задачи: «Ввод данных»
textual
Листинг программы
Console.WriteLine("Введите i:");
int i = Int32.Parse(Console.ReadLine());
while (i > 0) { Console.WriteLine(i); --i; };
Console.WriteLine("Введите j:");
int j = Int32.Parse(Console.ReadLine());
do { Console.Write(j); --j; Console.Write(" "); } while (j > 0);