如何在C#中将程序编写为12345 1234 123 12 1 [英] how to write program in c# as 12345 1234 123 12 1
本文介绍了如何在C#中将程序编写为12345 1234 123 12 1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi ,i have to write a program in c# which will display the output as
12345
1234
123
12
1
我已经为
编写了代码
i have written code for
54321
5432
543
54
5
为
as
for (int i = 1; i <= 5; i++)
{
for (int j = 5; j >= i; j--)
{ Console.Write(j);
}
Console.WriteLine();
for (int k = i; k > 0; k--)
{ Console.Write(" ");
}
}
推荐答案
Sooooo,将其逆转...我们不为他们做家庭作业-不是因为w'e'乐于助人,但因为我们认为您实际学习一些东西很重要.
学习成为一名程序员的一部分是学习如何分析问题并提出解决方案.
Sooooo, reverse it... We don''t do people''s homework for them - not because w''e''re tooc good to help, but because we think it''s important that you actually learn something.
Part of learning to be a programmer is learning how to analyze the problem and come up with a solution.
Console.WriteLine("12345");
Console.WriteLine(" 1234");
Console.WriteLine(" 123");
Console.WriteLine(" 12");
Console.WriteLine(" 1");
这篇关于如何在C#中将程序编写为12345 1234 123 12 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文