How to use an integer as a percentage in C# (Without using doubles)
How do I use an int variable as a percentage, to calculate data. For example, I'm doing a practice for "Passing Arguments" in C# and I need to read in two integers, a salary and a raise. For example 5000 & 15. Im supposed to figured out the total salary after 5000 has been increased by 15% Here's my code but I don't understand why the math is correct on paper, yet not in the computer. static void Main(string[] args) { int salaryBudget = Convert.ToInt32(Console.ReadLine()); int percent = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Before the increase: " + salaryBudget); //complete the method call Increase(ref salaryBudget, ref percent); Console.WriteLine("After the increase: " + salaryBudget); } //complete the method static void Increase(ref int a, ref int b) { a = (a + (a * (b/100))) }