現在forの2重ループで下のような図形ができるように下のプログラムを書いたのですが、うまくいきません。なぜ下のプログラムではいけないのかは大体わかるのですが、どのように直せばうまくいくのかがわかりません。どなたか教えていただけませんか?
■□□□□□□□□□
■■□□□□□□□□
■■■□□□□□□□
■■■■□□□□□□
■■■■■□□□□□
■■■■■■□□□□
■■■■■■■□□□
■■■■■■■■□□
■■■■■■■■■□
■■■■■■■■■■```lang-<using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Hello_World_
{
class Program
{
static void Main(string[] args)
{
int i,j;
for (i = 9; i >= 0; i--)
{
for (j = 1; j <= (10-i); j++)
{
Console.Write("■");
}
Console.Write("□");
Console.WriteLine();
}
}
}
}
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。