-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
104 lines (80 loc) · 1.44 KB
/
Program.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// See https://aka.ms/new-console-template for more information
Console.Write("Enter a Number");
int number = Convert.ToInt32(Console.ReadLine());
if (number % 5 == 0)
{
Console.WriteLine("Output:Yes");
}
else
{
Console.WriteLine("Output:No");
}
int x1 = 5;
int y1 = 10;
Console.WriteLine("x = 5;y=10");
Console.WriteLine($"x+y={x1 + y1}");
if (x1 > y1)
{
Console.WriteLine($"x-y={x1 - y1}");
}
else
{
Console.WriteLine($"y-x={y1 - x1}");
}
Console.WriteLine($"x*y={x1 * y1}");
Console.WriteLine($"x/y={x1 / y1}");
if (y1 != 0 && x1 != 0)
{
if (x1 > y1)
{
Console.WriteLine($"x/y={x1 / y1}");
}
else
{
Console.WriteLine("not allowed to divide by zero");
}
}
int x2 = 0;
int y2 = 20;
Console.WriteLine("x = 0;y=20");
Console.WriteLine($"x+y={x2 + y2}");
if (x2 > y2)
{
Console.WriteLine($"x-y={x2 - y2}");
}
else
{
Console.WriteLine($"y-x={y2 - x2}");
}
Console.WriteLine($"x*y={x2 * y2}");
if (y2 != 0 && x2 != 0)
{
if (x2 > y2)
{
Console.WriteLine($"x/y={x2 / y2}");
}
}
else
{
Console.WriteLine("not allowed to divide by zero");
}
int x = 5;
int y = 12;
int temp;
temp = x;
x = y;
y = temp;
Console.WriteLine($"after swap: x={x}, y={y}");
int input = 5;
for (int i = 1; i <= 9; i++)
{
Console.WriteLine($"{input} *{i}={input * i}");
}
int n = 10;
for (int i = 1; i <= n; i++)
{
if (i % 2 == 0)
{
Console.WriteLine($"{i * i}");
}
}