+ 1

What's wrong in this program?

public class Program { public static void main(String[] args) int i,sp=0,j,r=5,n=4,p; for (i=1;i<=5;i++) {System.out.println(); for(j=1;j<=r;j++) {System.out.print(j); } r--; {if((sp>0)&&(sp<4)) for (j=1;j<=sp;j++) {System.out.print(" "); } } for (p=n;p>0;p--) { System.out.print(p); } if(i>2); n--; } }

7th Apr 2018, 1:17 AM
vijay chaudhary
vijay chaudhary - avatar
6 Answers
+ 1
Bad formatting, identation and poor variable naming and no comments, leads to bugs. It's very difficult to read. There needs to be more teaching of good software engineering practises, and not just 'how to code' lessons (on degrees, as well as on SoloLearn).
7th Apr 2018, 1:52 AM
Emma
+ 1
Hi Bro
21st Apr 2018, 2:26 PM
♄☆Sanmay Ghadai☆♄
♄☆Sanmay Ghadai☆♄ - avatar
+ 1
braces ki galti hai. jo tum nhi lagaye ho. public class Program { public static void main(String[] args) *{*int i,sp=0,j,r=5,n=4,p; for (i=1;i<=5;i++) {System.out.println(); for(j=1;j<=r;j++) {System.out.print(j); } r--; {if((sp>0)&&(sp<4)) for (j=1;j<=sp;j++) {System.out.print(" "); } } for (p=n;p>0;p--) { System.out.print(p); } if(i>2); n--; } * }* } Your mistake is in asterisk.
22nd Apr 2018, 3:48 PM
♄☆Sanmay Ghadai☆♄
♄☆Sanmay Ghadai☆♄ - avatar
+ 1
😊
11th Jun 2018, 7:46 AM
Sarvesh Chaudhary
Sarvesh Chaudhary - avatar
- 1
😙😂😂😂😂😂
7th Apr 2018, 2:23 AM
‏â€ȘMohamed El Shahat‬‏
‏â€ȘMohamed El Shahat‬‏ - avatar