-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmy_first_file
More file actions
53 lines (45 loc) · 1.26 KB
/
Copy pathmy_first_file
File metadata and controls
53 lines (45 loc) · 1.26 KB
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
using System;
class Program
{
static void Main()
{
using System;
class Program
{
static void Main(string[] args)
{
int num1 = 5; // First number
int num2 = 10; // Second number
int sum = num1 + num2; // Calculate the sum
Console.WriteLine("The sum of {0} and {1} is: {2}", num1, num2, sum);
}
}
Console.Write("Enter first number: ");
double num1 = Convert.ToDouble(Console.ReadLine());
Console.Write("Enter second number: ");
double num2 = Convert.ToDouble(Console.ReadLine());
if (num2 != 0)
{
double quotient = num1 / num2;
Console.WriteLine($"The quotient of {num1} divided by {num2} is {quotient}");
}
else
{
Console.WriteLine("Division by zero is not allowed.");
}
}
}
SUBTRACT TWO NUMBERS
using System;
class Program
{
static void Main()
{
Console.Write("Enter first number: ");
double num1 = Convert.ToDouble(Console.ReadLine());
Console.Write("Enter second number: ");
double num2 = Convert.ToDouble(Console.ReadLine());
double difference = num1 - num2;
Console.WriteLine($"The difference between {num1} and {num2} is {difference}");
}
}