GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Wednesday, 10 August 2022

[Solution] Final Population CodeChef Solution



Problem

There were initially X million people in a town, out of which Y million people left the town and Z million people immigrated to this town.

Determine the final population of town in millions.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • The first and only line of each test case consists of three integers XY and Z.
Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇

Output Format

For each test case, output the final population of the town in millions.

Explanation:

Test case 1: The initial population of the town was 3 million, out of which 1 million people left and 2 million people entered the town. So, final population = 3 - 1 + 2 = 4 million.

Test case 2: The initial population of the town was 2 million, out of which 2 million left and 2 million immigrated. The final population is thus 2+2-2 = 2 million.

No comments:

Post a Comment