dosseva

FUND_01.Train

Mar 7th, 2021 (edited)
394
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace _01_Train
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int wagons = int.Parse(Console.ReadLine());
  10.             int[] train = new int[wagons];
  11.             int sum = 0;
  12.  
  13.             for (int i = 0; i < train.Length; i++)
  14.             {
  15.                 train[i] = int.Parse(Console.ReadLine());
  16.                 sum += train[i];
  17.             }
  18.  
  19.             Console.WriteLine(String.Join(' ', train));
  20.             Console.WriteLine(sum);
  21.         }
  22.     }
  23. }
  24.  
RAW Paste Data