Perform arithmetic operation on floating values in c#, DOT NET Programming

Perform Arithmetic operations on Floating Values - C# Program

Hello, I've been trying so many codes for this but those codes didn't work well. Please write the code for Perform Arithmetic Operations on Floating Values in c#.

Posted Date: 2/11/2013 6:40:00 AM | Location : United States





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();

  }

}

Posted by Jacob | Posted Date: 2/11/2013 6:41:58 AM

Thanks for your Experts suggestion.

Posted by Bella | Posted Date: 2/11/2013 6:43:18 AM


Related Discussions:- Perform arithmetic operation on floating values in c#, Assignment Help, Ask Question on Perform arithmetic operation on floating values in c#, Get Answer, Expert's Help, Perform arithmetic operation on floating values in c# Discussions

Write discussion on Perform arithmetic operation on floating values in c#
Your posts are moderated
Related Questions
Finding Maximum & Minimum Numbers - C# Program I am facing some problems in the code for Finding Maximum & Minimum Numbers. Can anybody suggest me the proper code for it.

Project Description: I have a website that I have prepared, but I would like someone to make it look nicer. Most of the functionality is there, but I need help with design which

Name the classes that are introduced in the System.Numerics namespace. The following two new classes are introduced in the System.Numerics namespace:  BigInteger - Refers

I want help to update and customize existing POS system Project Description: We have pharmacy chain stores with existing POS system linked via VPN to server with local user o

upload files using file upload control to google drive

We would like you to develop the subsequent requirements in one plug-in already in production. The plug-in was developed in Visual Studio 2010 .NET Framework 4 C# and synchronizes

What is the use of connection object? The connection objects are used to connect a data to the Command object. 1)An OleDbConnection object is used with the  OLE-DB provider

Calculate Standard Deviation - C# Program Hello i am unable to find the code for Calculate Standard Deviation in c#. Can anybody please provide me the assignment help?

Prevent .NET DLL to be decompiled By design phase .NET embeds rich Metadata inside the executable code using the MSIL. Anyone can easily  decompile DLL back using tools such as

concept of strong names Strong name is similar to GUID(It is supposed to be unique in space and time) in the COM components.Strong Name is only needed when we need to deploy as