- 3

Guys I need help I have homework and the dr wants A pyramid of numbers like this. 1\n 212\n 32123 , \n means new line

Deadline will finish at 11:30 PM

3rd Nov 2020, 7:20 PM
x _6rd
x _6rd - avatar
14 ответов
+ 13
x _6rd please show your tried code so we can help you out though the problem and give you feedback or improvement points over your code problem. If we directly sent you solution you won't be learn much so please attach an try of your code which is minimum execution of your problem which you able to do till now.
3rd Nov 2020, 7:23 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 9
x _6rd an way to acheive your task I just simplified the loop in two stages so you will understand easily about the problem occuring with the loop used by you. Just try to implement your version and loop by seeing this code. https://code.sololearn.com/cyUKlIzgmqTI/?ref=app
3rd Nov 2020, 7:40 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 1
I think this code will help you. This program is written in C ++ https://code.sololearn.com/cvPfpXqRAbwk/?ref=app
3rd Nov 2020, 7:47 PM
hossein B
hossein B - avatar
+ 1
Thank you so much I really appreciate that you save my life
3rd Nov 2020, 7:48 PM
x _6rd
x _6rd - avatar
0
Plz guys
3rd Nov 2020, 7:21 PM
x _6rd
x _6rd - avatar
0
Scanner input = new Scanner(System.in); System.out.println("enter number of rows at most 20: "); int rows = input.nextInt(); if(rows<=20) { for(int i = 0 ; i<=rows; i++) { for(int j = 20; j>i;j--) { System.out.print(" "); } for(int j = 0 ; j<i*2+1; j++) { System.out.print( i+1); } System.out.println(); } } else System.out.println("erorr input");
3rd Nov 2020, 7:24 PM
x _6rd
x _6rd - avatar
0
This code I do it and it is almost the answer but it's need some edits
3rd Nov 2020, 7:25 PM
x _6rd
x _6rd - avatar
0
Your second loop is wrong. You have to count down from i to 1 and then up to i again. Use two loops for that
3rd Nov 2020, 7:34 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
0
This loop is for space it forms the pyramid
3rd Nov 2020, 7:37 PM
x _6rd
x _6rd - avatar
0
I think the wrong is in loop 3 but I don't know how to solve it 💔
3rd Nov 2020, 7:37 PM
x _6rd
x _6rd - avatar
0
This code give this form 1 222 3333 44444 555555 But it is shape such as pyramid
3rd Nov 2020, 7:39 PM
x _6rd
x _6rd - avatar
0
I need like this shape but in different values
3rd Nov 2020, 7:40 PM
x _6rd
x _6rd - avatar
0
It is working I have no words enough to thank uuu❤️
3rd Nov 2020, 7:49 PM
x _6rd
x _6rd - avatar
0
This is the code,check it import java.util.Scanner; class Demo { public static void main (String[] args) { System.out.println("Enter the no. of rows"); Scanner a =new Scanner(System.in); int r= a.nextInt(); int i,j,k,l; for(i=1;i<=r;i++) { for(j=i;j<r;j++) { System.out.print(" "); } for(k=i;k>1;k--) { System.out.print(k); } for(l=1;l<=i;l++) { System.out.print(l); } System.out.println(); } } }
5th Nov 2020, 11:30 AM
Coder##***
Coder##*** - avatar