Write a program in C Sharp to print a table in for loop.
Sample Output
If you want to display table of 4 just enter 4 after that you get table of 4.
Whatever table you want just enter number and get table
Sample Solution
C# Sharp Codeusing System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Loop_Examples1 { class Program { static void Main(string[] args) { int num, i, result; Console.Write("Enter table number\t"); num = Convert.ToInt32(Console.ReadLine()); for (i = 1; i <= 10; i++) { result = num * i; Console.WriteLine("{0} x {1} = {2}", num, i, result); } Console.ReadLine(); } } }
Sample Output
If you want to display table of 4 just enter 4 after that you get table of 4.
Whatever table you want just enter number and get table
No comments:
Post a Comment