Qrist

Sum of the number

Apr 7th, 2020
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace GitHub
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int n = int.Parse(Console.ReadLine());
  11.             int[] num = new int[n];
  12.             int sum = 0;
  13.             for (int i = 0; i < n; i++)
  14.             {
  15.                 int n1 = int.Parse(Console.ReadLine());
  16.                 num[i] = n1;
  17.                 sum += num[i];
  18.             }
  19.             Console.WriteLine("Sum: " + sum);
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment