Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
- using System;
- using System.IO;
- using System.Linq;
- using System.Collections.Generic;
- namespace CSharp_Shell
- {
- public static class Program
- {
- public static void Main()
- {
- try {
- Console.Write("Halfway threshold: ");
- int thres = ReadInt();
- while(true)
- {
- Console.WriteLine("\n\n---INPUT----");
- Console.Write("Defense: ");
- int def = ReadInt();
- Console.Write("Damage: ");
- int inDmg = ReadInt();
- Console.WriteLine("\n---OUTPUT---");
- float reduc = 1 - def / (float)(def + thres);
- string inPercent = (reduc * 100).ToString() + "%";
- Console.Write($"Reduct: {inPercent}\n");
- int outDmg = (int)(inDmg * reduc);
- Console.Write($"Damage: {outDmg}\n");
- } } catch (Exception e) {
- Console.WriteLine("Hey idiot, " + e.Message.ToLower());
- System.Threading.Thread.Sleep(2500);
- Console.Clear();
- }
- Main();
- }
- private static int ReadInt() => int.Parse(Console.ReadLine());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement