.NET Fiddle

CSharp · Console

/Program.cs

using System;
					
public class Program
{
	public static void Main()
	{
		int health = 25;
		int healthMax = 100;
		float percentage = health / healthMax * 1f;
		Console.WriteLine(percentage);
		
		float percentage2 = health / (float)healthMax;
		Console.WriteLine(percentage2);
		
	}
}
;