In this article I would like to share with you I simple program that will generate a multiplication table using C# programming language. The code is very short and easy to understand.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Sample Program Output
Program Listing
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace multiplication_table
{
class multiplication_table
{
static void Main(string[] args)
{
int a = 2;
int b = 1;
int num=0;
System.Console.Write("\n\n");
System.Console.Write(" ===== MULTIPLICATION TABLE ===== ");
System.Console.Write("\n\n");
Console.Write(" ");
while (a <= 10)
{
num = (a * b);
Console.Write(num.ToString());
switch (num.ToString().Length)
{
case 1:
Console.Write(" ");
break;
case 2:
Console.Write(" ");
break;
case 3:
Console.Write(" ");
break;
default:
break;
}
if (a != 10)
{
a = a + 1;
}
else if (b < 10)
{
Console.WriteLine();
a = 1;
b = b + 1;
}
else break;
}
Console.Write("\n\n");
Console.Write("\t End of Program");
Console.Write("\n\n");
Console.ReadLine();
}
}
}
No comments:
Post a Comment