-
Notifications
You must be signed in to change notification settings - Fork 0
/
loop.cs
36 lines (33 loc) · 997 Bytes
/
loop.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace loop
{
class Program
{
static void Main(string[] args)
{
// Ask the user to input a number
Console.WriteLine("Enter a number: ");
int? num1 = Convert.ToInt32(Console.ReadLine());
// Check for null values before performing calculations
if (num1 != null)
{
// Display the multiplication table of the number
for (int i = 1; i <= 10; i++)
{
Console.WriteLine(num1 + " x " + i + " = " + (num1 * i));
}
}
else
{
// Handle null values
Console.WriteLine("The input value is null.");
}
// Wait for the user to press a key before closing the console window
Console.ReadKey();
}
}
}