Advertisement
tissiana

TrainByIvoUpdated

Oct 14th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace CondenseArayToNumber
  8. {
  9.     class Program
  10.     {
  11.         static void Main()
  12.         {
  13.             int wagons = int.Parse(Console.ReadLine());
  14.             int[] peopleInWagons = new int[wagons];
  15.             int sum = 0;
  16.             string passangers = "";
  17.  
  18.             for (int i = 0; i < wagons; i++)
  19.             {
  20.                 int people = int.Parse(Console.ReadLine());
  21.                 peopleInWagons[i] = people;
  22.                 passangers += peopleInWagons[i] + " "; // тук е всичко, което ти бягаше!
  23.                 sum += people;
  24.             }
  25.             Console.WriteLine(passangers + " ");
  26.             Console.WriteLine(sum);
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement