+ 1
What is the error of the following
public class Program { public static void main(String[] args) { int i,j,k,n; for(i=-3;n=Math .abs(i);n<=3;i++){ for (k=n;k>0;k--){ System .out .print(" ") ; } for (j=n;j<=2;j++){ System .out.print ("* ") ; } System .out .println (); n=Math .abs(i); } } }
4 Answers
+ 5
first remove math.abs as integers accept negative as well as positive values, and if 1 and 2 are the 2 digits you want to print then why are you putting "* "
+ 4
There are 4 arguments in your first for loop. There can only be 3. It also looks, on my screen, like you have unneeded spaces before your dots in your dot notation. Also, your print statements don't print anything.
+ 1
But still the output is not coming
+ 1
I want to print this-
1
1 2 1
1 2 3 2 1
1 2 1
1