Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class PrintNumsInInterval
- {
- static void Main()
- {
- /* Write a program that reads an integer number n from the console and prints all the numbers in the interval [1..n],
- * each on a single line.*/
- Console.WriteLine("Enter integer number greater than 1 to set the interval");
- int num = int.Parse(Console.ReadLine());
- Console.WriteLine("The interval is [1-" + num + "]");
- int i = 1;
- do
- {
- Console.WriteLine(i);
- }
- while (++i <= num);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement