IM嗨这里新和相当新的Java在学校香港专业教育学院有一个程序在这里,Ive得到工作了刚才打印它应该她的节目的方式如何打印出一列VS一排
import java.util.*;
public class stars
{
public static void main(String args[]){
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter the starting Value");
for(int star=keyboard.nextInt(); star>=1; star--)
{ for(int starTwo=star;starTwo>=1; starTwo--)
{
System.out.println("*");
}
}
}
}
它现在打印在一个直列中,它有正确的数字“*”,只是格式错误。 我需要它所以第7行有7,第6行有6行5有5等。一路为1.
预先感谢您。
向我们展示你的输入,预期的结果,预计输出 –
请理解的System.out.println意味着打印到一个新行。 您需要使用System.out.print(“*”); – Acewin