Wednesday, May 18, 2016

How to Make Multiplication Table in C# - Simple Console Application

I just remeber my elementry school days in 1980- we need  to stand up and tell the table -from 1 to 16  for any table. But i checked with my kids before starting this article -they said, nowdays upto ten only for any table.


So here is how write a simple C#  code - to develop table.

----------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
// Muitiplication Table by G Selvam
namespace ConsoleApplication27
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter the Table Number to Print");
            int tablename = int.Parse(Console.ReadLine());
            int start = 1;

            Console.WriteLine( "Multiplication Table--  " + tablename);
            while (start < 17)
            {
                                Console.WriteLine(start + " * " + tablename  +"=  " + start * tablename);
                start = start + 1;
            }
            Console.ReadLine();
        }
    }
}

--------------------------When Run by Pressing F5--------you will get below output.

User will input the table name : & System will print the table
----------------------------------------------------------------------------------




No comments:

Post a Comment