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
Could you please explain to me the different types of DOT NET programming

Need to get a windows desktop application developed Project Description: I am looking to obtain a desktop application developed. The desktop application will have the subsequ

What is the difference between VB6 and VB.Net? VB6 1.       It is Object-based Language 2.       It Does not support Threading 3.       Not powerful Exception handli

I need Beautiful Chatting Application Project Description: I need a beautiful chatting application created that has both private as well as public chat system. The chatting c

We need vb.net windows application programmer with min six years exp to work on our email marketing project Project Description: We need a windows application vb.net programm

Project Description: I am seeking a serious and motivated software developer that can create for me software like scanspeeder with all the functions as it has. Only thing that I

This assignment is based on lectures, tutorials, computer labs and research work. 1. Background During the lectures and tutorials on business process modeling and business

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.

Need Software Reconfiguration Project Description: I have a small program -exe that after selecting an item from the menu it start an .xls file and executes a security proces

What are LINQ query expressions? A LINQ query, also known as a query expression, having of a combination of query clauses that identify the data sources for the query. It conta