Percentage calculation in C#
Assuming you have a number80
and you need to calculate the 20%
value you can do below:using System;
public class Program
{
public static void Main() {
int wholeValue = 80;
int percentageValue = 20;
double percentageResult = (wholeValue * percentageValue) / 100;
Console.WriteLine(percentageResult);
}
}
Output
16