Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Train
- {
- class Program
- {
- static void Main()
- {
- int wagonsCount = int.Parse(Console.ReadLine());
- int[] peopleCount = new int[wagonsCount];
- int totalPeopleCount = 0;
- string passangers = "";
- for (int i = 0; i < wagonsCount; i++)
- {
- int people = int.Parse(Console.ReadLine());
- peopleCount[i] = people;
- totalPeopleCount += people;
- passangers = passangers+ peopleCount[i] + " ";
- if (i == wagonsCount - 1)
- {
- Console.WriteLine(passangers);
- Console.WriteLine(totalPeopleCount);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement