By GokiSoft.com|
10:08 05/10/2021|
C Sharp
Hiển thị hình tam giác - Lập trình C# - Loop trong C#
Thực hiện vẽ hình sau
* * * * * *
* * * * *
* * * *
* * *
* *
*
Độ cao N = 6
Yêu cầu nhập N từ bàn phím. Hiển thị ra hình tương tự trên vs độ cao N
Tags:
Phản hồi từ học viên
5
(Dựa trên đánh giá ngày hôm nay)
Thành Lâm
2020-05-17 17:29:29
using System;
public class Class1
{
public Class1()
{
static void Main(string[] args)
{
Console.WriteLine("So hang ban can la: ");
int n = int.Parse(Console.ReadLine());
for (int i = 0; i <= n; i++)
{
for(int j =i; j <= i; j++)
{
Console.WriteLine("*");
}
Console.WriteLine("\n");
}
}
}
}
Phạm Ngọc Minh
2020-05-17 03:42:32
using System;
namespace T1907A
{
class Program
{
static void Main(string[] args)
{
Console.Write("So Hang : ");
int n = int.Parse(Console.ReadLine());
for (int i = n; i > 0; i--)
{
for (int j = 1; j <= i; j++)
{
Console.Write("*");
}
Console.Write("\n");
}
}
}
}
nguyễn văn huy
2020-05-16 05:31:18
using System;
namespace chanle
{
class Program
{
static void Main(string[] args)
{
Console.Write("Nhap *: ");
int n = int.Parse(Console.ReadLine());
for (int i = n; i > 0; i--)
{
for (int j = 1; j <= i; j++)
{
Console.Write("*");
}
Console.Write("\n");
}
}
}
}
hoangduyminh
2020-05-16 02:29:07
using System;
namespace Tam_Giac
{
class Program
{
static void Main(string[] args)
{
Console.Write("Nhap Vao: ");
int n = int.Parse(Console.ReadLine());
for (int i = n; i > 0; i--)
{
for (int j = 1; j <= i; j++)
{
Console.Write("*");
}
Console.Write("\n");
}
}
}
}
Minh Nghia
2020-05-15 14:26:13
using System;
namespace TamGiac
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter the row number : ");
int n = Convert.ToInt32(Console.ReadLine());
for(int i = n; i >= 1; i--)
{
for(int j = i; j >= 1; j--)
{
Console.Write(" * ");
}
Console.WriteLine("\n");
}
}
}
}
Trần Mạnh Dũng
2020-05-15 11:18:22
using System;
namespace hinhtamgiac
{
class Program
{
static void Main(string[] args)
{
for(int i = 6; i >= 1 ; i-- )
{
for(int j = i; j >= 1 ; j--)
{
Console.Write(" * ");
}
Console.WriteLine("\n");
}
}
}
}
Đỗ Văn Huấn
2020-05-15 11:12:53
using System;
namespace Phuongtrinhbacnhat
{
public class Intamgac
{
static void Main(string[] args)
{
Console.Write("Nhap so hang: ");
int n = int.Parse(Console.ReadLine());
for (int i = n; i > 0; i--)
{
for (int j = 1; j <= i; j++)
{
Console.Write("*");
}
Console.Write("\n");
}
}
}
}
Trương Công Vinh
2020-05-15 10:41:08
using System;
namespace tamgiac
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
for(int i = 6; i >= 1 ; i-- )
{
for(int j = i; j >= 1 ; j--)
{
Console.Write(" * ");
}
Console.WriteLine("\n");
}
}
}
}
Phí Văn Long
2020-05-15 09:56:51
using System;
namespace VeTamGiac
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
int i, j, SoHang;
Console.Write("Nhap so hang: ");
SoHang= Convert.ToInt32(Console.ReadLine());
for (i = 1; i <= SoHang; i++)
{
for (j = 1; j <= i; j++)
Console.Write("*");
Console.Write("\n");
}
}
}
}