Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

1.

using System;

2. using System.Collections.Generic;

3. using System.Linq;

4. using System.Text;

5.  

6. namespace Arithmetic_Operators

7. {

8. class Program

9. {

10. static void Main(string[] args)

11. {

12. int num1, num2;

13. int add, sub, mul;

14. float div;

15.  

16.

17. Console.Write("Enter first number\t\t");

18. num1 = Convert.ToInt32(Console.ReadLine());

19.  

20. Console.Write("\n\nEnter second number\t\t");

21. num2 = Convert.ToInt32(Console.ReadLine());

22.  

23.
24. //Used + operator for adding values

25. add = num1 + num2;

26. //Used - operator for subtracting values

27. sub = num1 - num2;

28. //Used * operator for multiplying values

29. mul = num1 * num2;

30. //Used / operator for dividing values

31. div = (float)num1 / num2;

32.  

33. //Displaying Output

34. Console.WriteLine("\n\n=====================\n");

35. Console.WriteLine("Addition\t\t{0}", add);

36. Console.WriteLine("Subtraction\t\t{0}", sub);

37. Console.WriteLine("Multiplication\t\t{0}", mul);

38. Console.WriteLine("Division\t\t{0}", div);

39. Console.WriteLine("\n=======================\n");

40.  

41. Console.ReadLine();

42. }

43. }

44. }
Enter first number   15

Enter second number   12

=====================

Addition   27

Subtraction   3

Multiplication   180

Division   1.25

=======================

You might also like