You can use Typecasting method.
Type casting is a way of converting data from one data type to another data type. This process of data conversion is also known as type conversion or type coercion
You can do this.
float(ans) = float ( op1/op2);
C# Type Casting
Type casting is when you assign a value of one data type to another type.
In C#, there are two types of casting:
Implicit Casting (automatically) - converting a smaller type to a larger type size
- char -> int -> long -> float -> double
Explicit Casting (manually) - converting a larger type to a smaller size type
- double -> float -> long -> int -> char