0
Why isn't the practice code working? Everything should be correct, but both output values are the same.
namespace SoloLearn { class Program { static void Main(string[] args) { int salaryBudget = Convert.ToInt32(Console.ReadLine()); int percent = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Before the increase: " + salaryBudget); Increase(ref salaryBudget, ref percent); Console.WriteLine("After the increase: " + salaryBudget); } static void Increase(ref int x, ref int y) { x = x * ((100 + y)/100); } } }
2 ответов
+ 3
Make use of double types, expression "100+y/100" is always converted to 1 from 1.4 or something else.
+ 2
Damn, I completely forgot about data types. Thanks!