mayap

SumOfNnumbers

Apr 11th, 2014
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace SumOfNumbers
  8. {
  9.     class SumOfNumbers
  10.     {
  11.         static void Main()
  12.         {
  13.             int n;
  14.             Console.WriteLine("Ënter number n: ");
  15.             n = int.Parse(Console.ReadLine());
  16.            
  17.             double sum = 0;
  18.             Console.WriteLine("Numbers: ");
  19.  
  20.             double numbers;
  21.             for (int i = 1; i <= n; i++)
  22.             {
  23.                 numbers = double.Parse(Console.ReadLine());
  24.                 sum = sum + numbers;
  25.                 Console.WriteLine("Your number: {0,3}", numbers);
  26.             }
  27.             Console.WriteLine();
  28.             Console.WriteLine("Sum of numbers: " + sum);
  29.             Console.WriteLine();
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment