Program code for Arithmetic Operations on Floating Values
using System;
class floatdemo
{
public static void Main()
{
string s1,s2;
float a,b;
Console.Write("Enter no 1 # "); // Display to enter no. 1
s1 = Console.ReadLine (); // save the number in a string variable s1
a = float.Parse (s1); // the string s1 is converted into float type variable
Console.Write("Enter no 2 # "); //Display to enter no. 2
s2 = Console.ReadLine (); // save the number in a string variable s2
b = float.Parse (s2); // the string s2 is cinverted into float type variable
// Here er converted both the string variables to float because we wanted to do
// float / numeric manipulation with the inputted string variables
Console.WriteLine(""); // Blank line
Console.WriteLine("*** Integer manipulations ****");
Console.WriteLine(""); // Blank line
// Integer manipulations
Console.WriteLine("No1 + No2 = " + (a+b));
Console.WriteLine("No1 - No2 = " + (a-b));
Console.WriteLine("No1 / No2 = " + (a/b));
Console.WriteLine("No1 * No2 = " + (a*b));
Console.WriteLine("No1 % No2 = " + (a%b));
Console.ReadLine();
}
}