Thursday, July 30, 2009

How do you generate a 10x10 multiplication table in C# using for statements?

A console application that accepts an input as an integer (n). Then displays a 10x10 multiplication table beginning from n using for or while statements.

How do you generate a 10x10 multiplication table in C# using for statements?
using System;


using System.Collections.Generic;


using System.Text;





namespace ConsoleApplication2


{


class Program


{


static void Main(string[] args)


{


Console.Write("Please enter an integer to generate a" + "multiplication table for: ");





int num = int.Parse(Console.ReadLine());





for (int i = 0; i %26lt; 10; i++)


{


for (int j = 0; j %26lt; 10; j++)


{


Console.Write((num + i) * (num + j) + "\t");


}


Console.Write("\n");


}


}


}


}


No comments:

Post a Comment