Advertisement
kuruku

NumbersToN

Apr 19th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. using System;
  2.  
  3. //Write a program that enters from the console a positive integer n and prints all the
  4. //numbers from 1 to n, on a single line, separated by a space
  5.  
  6.     class NumbersToN
  7.     {
  8.         static void Main()
  9.         {
  10.             Console.Write("N = ");
  11.             int n = int.Parse(Console.ReadLine());
  12.             for (int i = 1; i <= n; i++)
  13.             {
  14.                 Console.Write("{0} ",i);
  15.             }
  16.             Console.WriteLine();
  17.         }
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement