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
I need deatch-bycahpca API tutorial Please teach me how to use deatch-bycahpa API Skills required: Visual Basic, C# Programming

Question: (a) Write extract codes to show the structure of the Global.asax file. (b) Outline four classes that allow you to work with File Streams. (c) When working with

Develop a Hotel Booking Wholesale System Project Description: This project is about to prepare a hotel wholesale system for B2B offering travel agents and affiliate websites

What is the difference between proc. sent BY VAL and By Ref? By val: changes will not be reflected back to the variable. By ref: changes will be reflected back to that varia

This assignment will have you create a simple static web page. It should look something like this: The colored boxes do not represent colors I want to see, make it look nic

What are benefits & Limitation of  Hidden fields? The benefits of using Hidden fields are as shown below :- 1)    They are very simple to implement. 2)    As the data is

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?

What is object-oriented programming (OOP)? OOP is a technique to develop logical modules, like classes that contain properties, methods, fields, and events. An object is formed

What is a Class in dot Net? The class describes all the attributes of objects, as well as the methods which implement the behavior of member objects. It is a comprehensive data

What is SIX sigma? The Sigma means the deviation in Greek language. The Deviation means how much variations exist in a set of data. For illustrate  let's say in a software main