Wednesday, May 18, 2016

C# Program to display the different series output on the screen


C# Program to display the different series output on the screen

Program Statement:
Write a program which display the following output on the screen.1 2 3 4 51 4 9 16 251 8 27 64 125

Solution: static void Main(string[] args)
{
for (int i = 1; i <= 5; i++)
Console.Write(i+" ");

Console.WriteLine();

for (int i = 1; i <= 5; i++)
Console.Write(i * i+" ");

Console.WriteLine();

for (int i = 1; i <= 5; i++)
Console.Write(i * i * i+" ");

Console.RdLine();
}


No comments:

Post a Comment