Advertisement
VyaraG

RepetitiveStructures

Nov 30th, 2014
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2. //Create a program to ask the user for two numbers and display the numbers between them (both included), three times: using "for", using "while" and using "do..while"
  3.  
  4. //Enter first number: 6
  5. //Enter last number 12
  6.  
  7. //6 7 8 9 10 11 12
  8. //6 7 8 9 10 11 12
  9. //6 7 8 9 10 11 12
  10. class RepetitiveStructures
  11. {
  12.     static void Main()
  13.     {
  14.         int firstNumber = int.Parse(Console.ReadLine());
  15.         int secondNumber = int.Parse(Console.ReadLine());
  16.  
  17.         for (int column = 1; column <= 3; column++) // draws the columns
  18.         {
  19.             for (int line = firstNumber; line <=secondNumber; line++) //fills in the rows with numbers
  20.             {
  21.                 Console.Write("{0} ", line);
  22.             }
  23.             Console.WriteLine(); // interval at the end of each line
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement