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
Develop a Face Recognition Systems Project Description: Seeking for someone who has worked with Face Recognition techniques and is familiar with the relevant mathematical alg

Locate BUG website Project Description: Can you find a bug in easports fifa 14 ultimate team web app (easports/fifa/football-club/ultimate-team) so that i will earn a lot of

#queWrite a XML with database with book details (BOOK ID, Title, Author, subject, published Year, language, vendor, price)stion..

I have a code in C# which uses Microsoft Solver Foundation to solve linear programming model. But the problem is the code is too long, there are too many variables and constraints,

PhotoHandler add-on to display file names Project Description: I want a website with a photo gallery using PhotoHandler. I need the code added/ modified to display the image

Can you give an overview of ADO.NET architecture? The most important partĀ  in the ADO.NET architecture is the "Data Provider". TheĀ  Data Provider provides access to the datasou

Help with making a wrapper in c# for ffmpeg to extract audio from video

Professional TELERIK Bind MS ACCESS Required: 1. Including custom fields to the Schedule. 2. Schedule Calendar Sync with Outlook 3. Selecting display in Schedule res

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 Perfor

What does a break statement do in the switch statement? The switch statement is a selection control statement that is used to handle many choices and transfer control to the ca