write java applications that print the following pyramid using an array.
User must enter the number of start to displays.
Example: Please enter the number of stat to displays: 6.
*
**
***
****
*****
******
1
Expert's answer
2012-05-09T10:14:59-0400
import java.util.Scanner; public class Main {
public static void main(String[] args) { int numberofstat=0; Scanner input = new Scanner(System.in); System.out.print("Please enter the number of stat to displays: "); numberofstat =input.nextInt(); String str=""; for(int i=0;i<numberofstat;i++){ str+="*"; System.out.print(str+" "); } } }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment