这个想法是输入一个数字,从开始并逐渐减少数字。此外,如果你达到9,模式从1开始。
示例输出1:
11111 2222 333 44 5
11111 2222 333 44
11111 2222 333
11111 2222
11111
示例输出2:
7777 888 99 1
7777 888 99
7777 888
7777
编辑:对不起,我真的没有代码,因为我不知道自己在做什么,但即使答案的代码不对,它也帮助我开始了。此外,数字必须在末尾降到1个数字。
这是我现在的代码,它构成了第一行:
public String makePattern()
{
String output = "";
int amountPlace = amount; //amount is the imput
int amount2 = amount;
for(int i = 0;i < amount; i++)
{
for(int n = amount2; n > 0;n--)
{
output = output + amountPlace + "";
}
output = output + " ";
amountPlace++;
amount2--;
if(amountPlace==10)
amountPlace=1;
}
return output;
}
我仍然需要别人帮我做其他的台词。
为什么不试试这个,然后
int numcount = 5;
string num_output = "";
for(int i = 0;i < 9; i++){
for(int n = 0; n < numcount;n++){
num_output += 'NUMBER TO APPEND';
}
numcount--;
}