本文介绍了C#.net代码错误请参阅以下代码并纠正错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Friends,



我在c#语言的帮助下练习编程工作。

我发现这个程序无法打印所需的输出我想要的。



请帮我找出错误。



谢谢你。



代码。

...................... ......

 使用系统; 
使用 System.Collections.Generic;
使用 System.Linq;
使用 System.Text;

命名空间 logical_star_outer_pyramid
{
class 计划
{
静态 void Main( string [] args)
{
Console.WriteLine( 输入你的号码);
int i = int .Parse(Console.ReadLine());
for int j = 0 ; j < = i; j ++)
{
for int k = 1 ; k < =(i - j); k ++)
Console.Write( );
for int l = 1 ; l < = j; l ++)
{
if ( l == 1 || l == j || i == j)
Console.Write( * + );
else
Console.Write( );
}
Console.WriteLine();
}
Console.ReadLine();
}
}
}





输出应该是这样的: -

输入数字: -

4; IE;外金字塔(内金字塔或星星不应出现)



*
* *
* *
* * * * *

解决方案


Hello Friends,

I am practicing my programing assignment with the help of c# language.
I found that this program unable to print the desired output what i want.

Please help me out in finding the error.

Thank you.

Code.
............................

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace logical_star_outer_pyramid
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter your Number");
            int i = int.Parse(Console.ReadLine());
            for (int j = 0; j <= i; j++)
            {
                for (int k = 1; k <= (i - j); k++)
                    Console.Write(" ");
                for (int l = 1; l <= j; l++)
                {
                    if (l == 1 || l == j || i == j)
                        Console.Write("*" + "");
                    else
                        Console.Write(" ");
                }
                Console.WriteLine();
            }
            Console.ReadLine();
        }
    }
}



output should be like:-
Enter the Number:-
4;I.E; Outer Pyramid (inner pyramid or stars should not present)

    *
  *   *
 *     *
* * * * *
解决方案


这篇关于C#.net代码错误请参阅以下代码并纠正错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 17:36
查看更多