All Type Coding

Search Here

How to print the table of a number entered by user in c#

using System;

class abc
{
    int num, value = 0;
    public void tab()
    {
        Console.WriteLine("Enter the number to find its table");
        num = int.Parse(Console.ReadLine());
        Console.WriteLine("Table is : ");
        Console.WriteLine("\n");
        for (int i = 1; i <= 10; i++)
        {
            value = num * i;
            Console.WriteLine(num + "*" + i + "=" + value);
        }
        Console.ReadKey();
    }
}
class table
{
    public static void Main(string[] args)
    {
        abc a = new abc();
        a.tab();
    }
}
Output:







No comments :

Post a Comment