Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Bus
- {
- class Program
- {
- static void Main(string[] args)
- {
- int passengers = int.Parse(Console.ReadLine());
- int stops = int.Parse(Console.ReadLine());
- int count = 0;
- while (count != stops)
- {
- int leftPassengers = int.Parse(Console.ReadLine());
- int newPassengers = int.Parse(Console.ReadLine());
- passengers -= leftPassengers;
- passengers += newPassengers;
- if (count % 2 == 0)
- {
- passengers += 2;
- }
- else
- {
- passengers -= 2;
- }
- count++;
- }
- Console.WriteLine($"The final number of passengers is : {passengers}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement