Advertisement
silvana1303

sum of chars

May 25th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5.  
  6. namespace exampreparation
  7. {
  8.     class exam
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int number = int.Parse(Console.ReadLine());
  13.  
  14.             int[] variable = new int[number];
  15.  
  16.             for (int i = 0; i < number; i++)
  17.             {
  18.                 variable[i] = char.Parse(Console.ReadLine());
  19.             }
  20.  
  21.             int sum = variable.Sum();
  22.  
  23.             Console.WriteLine(sum);
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement