Write a program that reads from the console a positive integer number
N (N < 20) and prints a matrix of numbers as on the figures below:
N = 3
1 2 3
2 3 4
3 4 5
N = 4
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
using System;
namespace ConsoleApplication8
{
class Program
{
static void Main()
{
for (int i = 1; i <= 3; i++)
{
for (int j = 0; j <=2; j++)
{
Console.Write(i+j);
}
Console.WriteLine();
}
Console.ReadLine();
}
}
}
N (N < 20) and prints a matrix of numbers as on the figures below:
N = 3
1 2 3
2 3 4
3 4 5
N = 4
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
using System;
namespace ConsoleApplication8
{
class Program
{
static void Main()
{
for (int i = 1; i <= 3; i++)
{
for (int j = 0; j <=2; j++)
{
Console.Write(i+j);
}
Console.WriteLine();
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment