Perform arithmetic operations - c# program, DOT NET Programming

Perform Arithmetic Operations - c# Program

Hello, i didn't find the correct way of using arithmetic operations in c#. I am beginner for this language. Please suggest me some examples.

Posted Date: 2/11/2013 6:28:49 AM | Location : United States





Hey this a very easy code for your problem try this.

Perform Arithmetic Operations

using System;  

class integerdemo {

  public static void Main()

 {  

   string s1,s2;

   int a,b;  

  Console.Write("Enter no 1 # "); // Display to enter no. 1

  s1 = Console.ReadLine ();           // save the number in a string variable s1

  a = int.Parse (s1);                      // the string s1 is converted into int type variable  

  Console.Write("Enter no 2 # "); //Display to enter no. 2

  s2 = Console.ReadLine ();        // save the number in a string variable s2

  b = int.Parse (s2);                     // the string s2 is converted into int type variable

   // Here er converted both the string variables to int because we wanted to do 

   // integer / 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 | Posted Date: 2/11/2013 6:30:30 AM

Thanks it was very useful. I was?looking for this. Everything is ok and cleared.

Posted by Edward | Posted Date: 2/11/2013 6:32:27 AM


Related Discussions:- Perform arithmetic operations - c# program, Assignment Help, Ask Question on Perform arithmetic operations - c# program, Get Answer, Expert's Help, Perform arithmetic operations - c# program Discussions

Write discussion on Perform arithmetic operations - c# program
Your posts are moderated
Related Questions
I need Kinect Developer c++ We are creating a fitting room with Kinnect and I need some questions answered like how to detect if a person turns around, how to make the clothing

Looking to build FIFA coins selling and buying website Project Description: I would like a website made for FIFA 14 TEAM. What this website will do is having automatically bu

We need programmers and accountants Skills required are .NET, C# Programming, Graphic Design, Commercials, Software Architecture

Investment Equation - C# Program I didn't know the exact code for computing Investment Equation. Can anybody suggest me the correct way for my problem?

how to connect login page with my database and check the values with the database.

I need a Web Application UI Modernization - Preliminary Technology Assessment We are seeking to overhaul a 10-year old enterprise application, CRM-related as well as web-based t


What is the sequence of UML diagrams in project? At First let me say some fact about this question, you cannot implement all the nine diagrams given by the UML in one project;

What is CLR?  CLR(Common Language Runtime) is the major resource of .Net Framework. It is collection of services such as garbage collector, exception handler, jit compilers etc

Project Description: Need help to answer questions of VB.NET Skills required are .NET, Software Development, C# Programming, Visual Basic, Windows Desktop