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
GAC (Global Assembly Cache) is used where shared .NET assembly resides.Global Assembly Cache is used in the following situations:- 1) When the application has to be shared among

how much u guys cost for 5 pages website in .net?

Need Report Generation in SQL / .NET Project Description: Prepare a report generation web page by pulling information from an SQL Database. Filter parameters per report :

We have a web based program completed with .NET C# and Microsoft SQL Server. There are some reports requires to be created. Required Skills. - High Proficiency in .NET C#

read a file which has emp.no,name,age as per fields/you want to calculate no.of employess whose age more than50

I want a C# school project Project Description: The project is made in C# and haves a database connection. We have some small problems asking up data from the database.

What is Dispose method in .NET? The .NET provides "Finalize" method in which we can clean up our resources. But relying on this is not always better so the best is to implement

How can you make a simple harmonic motion in visual basic 2010 where you will ask an input to the user and your output will be a moving pendulum and a graph. Also the displacement

How can you provide an alternating color scheme in a Repeater control?  AlternatingItemTemplate Like the ItemTemplate element, but rendered for each other row (alternating item

This assignment is about writing a C# application that creates a minimal student enrolment system. The application will display lists of papers and students. The user can enrol stu