Advertisement
Dianov

Data Types and Variables - Exercise (10. Poke Mon (not included in final score))

Aug 7th, 2021
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2.  
  3. namespace PokeMon
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int pokePower = int.Parse(Console.ReadLine());
  10.             int distance = int.Parse(Console.ReadLine());
  11.             int exhaustionPower = int.Parse(Console.ReadLine());
  12.             int startingPokePower = pokePower;
  13.             int targets = 0;
  14.  
  15.             while (pokePower >= distance)
  16.             {
  17.                 targets++;
  18.                 pokePower -= distance;
  19.  
  20.                 if (pokePower == startingPokePower / 2 && exhaustionPower != 0)
  21.                 {
  22.                     pokePower /= exhaustionPower;
  23.                 }
  24.             }
  25.             Console.WriteLine(pokePower);
  26.             Console.WriteLine(targets);
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement