0
What is the problem in this Java program
4 Answers
+ 2
You have a syntax error in your for loop. You out a comma instead of a semi-colon.
+ 2
* mainly your main method declaration is wrong.. So it won't run. Read again about main method.
* Capital S in scanner; but you are not using it so remove it.
* cnt = i; i is uninitialized so initialize i before i assigning or put cnt = 0;
* put ; after I=1 instead of camma, in loop.
try these
Hope it helps...
0
you don't know how to write a starting template of Java code. First please learn the basics of java.
I Modify your Code//
import java.util.Scanner;
class program
{
public static void main(String args[]){
int i,j,cnt=0;
for(i=1; i<=4; i++)
{
for(j=4;j>=1;j--)
{
System .out.println (cnt);
cnt++;
}
System .out.println ();
}
}
}
0
Please add Java to your post's tags for language context clarity ā
https://code.sololearn.com/W3uiji9X28C1/?ref=app