-
Notifications
You must be signed in to change notification settings - Fork 0
/
Easy Calc.cs
77 lines (59 loc) · 1.59 KB
/
Easy Calc.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
namespace Easy_Calc
{
class Program
{
public static void Addition(int fno, int sno)
{
Console.WriteLine("Addition is:" + (fno + sno));
}
public static void Subtraction(int fno, int sno)
{
Console.WriteLine("Subtraction is:" + (fno - sno));
}
public static void Division(int fno, int sno)
{
Console.WriteLine("Division is:" + ((float)fno / sno));
}
public static void Multi(int fno, int sno)
{
Console.WriteLine("Multiplication is:" + ((float)fno * sno));
}
// Below Main Method
static void Main(String[] args)
{
int fno, sno, result;
string symbol_choice,value_continue;
do
{
Console.WriteLine("Enter first number");
fno= Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter second number");
sno = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter symbol for operation:");
Console.WriteLine(" +, -, /, * ");
symbol_choice = Console.ReadLine();
switch (symbol_choice)
{
case "+":
Addition(fno, sno);
break;
case "-":
Subtraction(fno, sno);
break;
case "/":
Division(fno, sno);
break;
case "*":
Multi(fno, sno);
break;
default:
Console.WriteLine("Pleae enter valid Symbols for operation:");
break;
}
Console.WriteLine("Press y for continue & press n for Exit");
value_continue = Console.ReadLine();
}while(value_continue=="y" || value_continue=="Y");
}
}
}