Advertisement
iliqnvidenov

sum of N numbers.

Nov 28th, 2014
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.38 KB | None | 0 0
  1. using System;    
  2.  
  3. class SumOfNumbers
  4.  
  5. {
  6.     static void Main()
  7.     {
  8.         int n = int.Parse(Console.ReadLine());
  9.         double sum = 0;
  10.         Console.WriteLine();
  11.         for (int i = 1; i <= n; i++)
  12.         {
  13.             double number = double.Parse(Console.ReadLine());
  14.             sum += number;
  15.         }
  16.         Console.WriteLine("Sum={0}",sum);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement