1******
12*****
123****
1234***
12345**
123456*
1234567
Solution:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Csharp_exercises
{
class Program
{
static void Main(string[] args)
{
int i,j,k;
for (i = 1; i <= 7; i++)
{
for (j = 1; j <= i; ++j)
Console.Write(j);
for (k = 7 - i; k >= 1; k--)
Console.Write("*");
Console.Write("\n");
}
Console.ReadLine();
}
}
}
12*****
123****
1234***
12345**
123456*
1234567
Solution:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Csharp_exercises
{
class Program
{
static void Main(string[] args)
{
int i,j,k;
for (i = 1; i <= 7; i++)
{
for (j = 1; j <= i; ++j)
Console.Write(j);
for (k = 7 - i; k >= 1; k--)
Console.Write("*");
Console.Write("\n");
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment