+ 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--; } }
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).
+ 1
Hi Bro
+ 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.
+ 1
đ
- 1
đđđđđđ