VelizarAvramov

03. Exact Sum of Real Numbers

Nov 5th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _03._Exact_Sum_of_Real_Numbers
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //Write program to enter n numbers and calculate and print their exact sum (without rounding).
  10.             int n = int.Parse(Console.ReadLine());
  11.             decimal sum = 0;
  12.             for (int i = 1; i <=n; i++)
  13.             {
  14.                 decimal curent = decimal.Parse(Console.ReadLine());
  15.                 sum += curent;
  16.             }
  17.             Console.WriteLine(sum);
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment