C#简单的程序解决. [英] c# simple program solve.
本文介绍了C#简单的程序解决.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
****
****
****
****
如何在c#程序中打印*,
我的代码:
****
****
****
****
how to print * in c# program,
my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace csharp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter the number");
int n = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
Console.Write("*");
}
Console.WriteLine("");
Console.ReadLine();
}
}
}
}
soution:输入数字5
*****
我该如何打印****
****
****
****
soution : enter the number 5
*****
how can i print ****
****
****
****
推荐答案
static void Main(string[] args)
{
Console.WriteLine("Enter the number");
int n = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
for (int j = 1; j < 4; j++)
Console.Write("*");
Console.WriteLine("");
Console.ReadLine();
}
}
我得到了这一结果
//console.Readline();行的提及不在循环中///
i got this soution
// console.Readline(); line mention is out side for loop//
这篇关于C#简单的程序解决.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文