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)
![Triệu Văn Lăng [T2008A]](https://www.gravatar.com/avatar/1348e3562c6492c26f796cb1f45982a1.jpg?s=80&d=mm&r=g)
Triệu Văn Lăng
2021-05-17 08:18:46
using System;
namespace bai1398
{
class TamGiacSao
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Console.WriteLine("Ve tam giac hinh sao");
int n, i, j;
Console.WriteLine("Nhap n: ");
n = Convert.ToInt32(Console.ReadLine());
for(i = n; i >= 1; i--)
{
for (j = 1; j <= i; j++)
Console.Write("* ");
Console.WriteLine("\n");
}
Console.ReadKey();
}
}
}
![hainguyen [T2008A]](https://www.gravatar.com/avatar/32855ce6db55d60134d830aee06b41e5.jpg?s=80&d=mm&r=g)
hainguyen
2021-05-17 08:07:29
using System;
namespace Lesson02
{
class Program
{
static void Main(string[] args)
{
int N;
N = Int32.Parse(Console.ReadLine());
for (int i = N; i > 0; i--)
{
for (int j = 0; j < i; j++)
{
Console.WriteLine("*");
}
Console.WriteLine("\n");
}
}
}
}
![Trần Văn Lâm [T2008A]](https://www.gravatar.com/avatar/cfc15c8cb7781ad669b013e01f9f1a6b.jpg?s=80&d=mm&r=g)
Trần Văn Lâm
2021-05-17 08:04:44
{
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 6; i++) {
for(int j = 0; j <6-i; j++)
{
Console.WriteLine("*");
}
Console.WriteLine("\n");
}
Console.ReadKey();
}
}
}
![Nguyễn Tiến Đạt [T2008A]](https://www.gravatar.com/avatar/b5819cd0adc95c727c7ad0c2bcf6098b.jpg?s=80&d=mm&r=g)
Nguyễn Tiến Đạt
2021-05-17 07:56:33
using System;
namespace InHinhTamGiac
{
class Program
{
static void Main(string[] args)
{
int N;
N = Int32.Parse(Console.ReadLine());
for(int i = N; i > 0; i--)
{
for(int j = 0; j < i; j++)
{
Console.Write("*");
}
Console.WriteLine();
}
}
}
}
![Nguyễn Hoàng Anh [C1907L]](https://www.gravatar.com/avatar/5b7bb435cae0d0a0fd414f6fdd0adc87.jpg?s=80&d=mm&r=g)
Nguyễn Hoàng Anh
2020-06-25 12:26:31
using System;
using System.Collections.Generic;
using System.Text;
namespace Lession1
{
class Class3
{
static void Main(string[] args)
{
Console.WriteLine("Nhap vao n :");
int n = int.Parse(Console.ReadLine());
for (int i = n; i >= 0; i--)
{
for (int j = 0; j < i; j++)
{
Console.Write("*");
}
Console.Write("\n");
}
}
}
}
![Ngô Quang Huy [C1907L]](https://www.gravatar.com/avatar/8e54dbf5994077ce599f49278164ae79.jpg?s=80&d=mm&r=g)
Ngô Quang Huy
2020-06-24 14:02:45
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bait
{
class Program
{
static void Main(string[] args)
{
for(int i = 0; i < 6; i++)
{
for (int j = 0; j< 6-i; j++){
Console.Write("*");
}
Console.Write("\n");
}
Console.Read();
}
}
}
![trung [C1907L]](https://www.gravatar.com/avatar/67c23432e4710f33dd14e580d41b0379.jpg?s=80&d=mm&r=g)
trung
2020-06-24 13:54:58
using System;
class MainClass {
public static void Main (string[] args) {
int x = int.Parse(Console.ReadLine());
while (x >= 1)
{
string str = "";
for (int i = 0; i < x; i++)
{
str += "* ";
}
str += "\n";
Console.WriteLine(str);
x--;
}
}
}
![Lê Minh Bắc [T1907A]](https://www.gravatar.com/avatar/22abcac77d8ca5e01144e240abb48d22.jpg?s=80&d=mm&r=g)
Lê Minh Bắc
2020-05-19 04:21:08
using System;
namespace Lession2
{
class Tamgiac
{
static void Main(string[] args)
{
Console.Write("Nhap N: ");
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");
}
Console.ReadKey();
}
}
}
![lê văn phương [T1907A]](https://www.gravatar.com/avatar/a07ddfb51e1e7189c76b4e42dbdbcddc.jpg?s=80&d=mm&r=g)
lê văn phương
2020-05-19 03:46:56
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HienThiHinhTamGiac
{
class Program
{
static void Main(string[] args)
{
Console.OutputEncoding = Encoding.UTF8;
Console.Write("Mời bạn nhập số hàng: ");
int h = int.Parse(Console.ReadLine());
for (int i = h; i > 0; i--)
{
for (int j = 1; j <= i; j++)
{
Console.Write(" * ");
}
Console.Write("\n");
}
Console.ReadKey();
}
}
}
![Phan Bạch Tùng Dương [T1907A]](https://www.gravatar.com/avatar/e74e3ec62fe3a191929e12eecbe01edf.jpg?s=80&d=mm&r=g)
Phan Bạch Tùng Dương
2020-05-19 02:10:39
using System;
namespace Ls4
{
class Program
{
static void Main(string[] args)
{
for (int i = 6; i >= 1; i--)
{
for (int k = i; k >= 1; k--)
{
Console.Write("*");
}
Console.WriteLine("\n");
}
}
}
}