Rabu, 23 Maret 2016

C Program to Print half Diamond shapes using numbers

,
C# Program to Print half Diamond shapes using numbers 1 to 10

Program Statement:
Write a program to produce the following output:
             1
          2   3
        4   5   6
       7  8  9  10

Solution:
 static void Main(string[] args)
{
int i,j,k=1;
for (i = 1; i <= 4; i++)
{
for (j = 4; j >= 1; j--)
{
if (j > i)
Console.Write(" ");
else
Console.Write(" " + k++ + " ");
}
Console.WriteLine();
Console.WriteLine();
}
Console.ReadLine();
}


0 komentar to “C Program to Print half Diamond shapes using numbers”

Posting Komentar

 

Make Money Online Now Free Copyright © 2016 -- Powered by Blogger