NelIfandieva

ExArrays_01_Train

Jan 30th, 2020
127
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int n = int.Parse(Console.ReadLine());
  2.             int[] train = new int[n];
  3.             int allPeople = 0;
  4.  
  5.             for (int i = 0; i < n; i++)
  6.             {
  7.                 int peopleInWagon = int.Parse(Console.ReadLine());
  8.                 train[i] = peopleInWagon;
  9.                 allPeople += peopleInWagon;
  10.             }
  11.  
  12.             string trainAsString = string.Join(" ", train);
  13.             Console.WriteLine(trainAsString);
  14.             Console.Write(allPeople);
RAW Paste Data