Dianov

Data Types and Variables - Lab (03. Exact Sum of Real Numbers)

Jul 10th, 2021
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.45 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ExactSumOfRealNumbers
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int numbers = int.Parse(Console.ReadLine());
  10.             decimal sum = 0;
  11.  
  12.             for (int i = 0; i < numbers; i++)
  13.             {
  14.                 decimal number = decimal.Parse(Console.ReadLine());
  15.                 sum += number;
  16.             }
  17.  
  18.             Console.WriteLine(sum);
  19.  
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment