+ 2
How to compile a program in Java for natural numbers..I can compile in eclipse compilers but in sololearn compiler can't compile
int i; for(i=0;i<=100;i++) { System.out.println(i); } below is my simple program but I can't get output for this what is answer
5 odpowiedzi
+ 4
It will print whole numbers from 0-100.
Is the code in the main method?
Like this:
public class Program{
public static void main(String[] a){
for(int i = 0; i <= 100; i++)
System.out.println(i);
}
}
+ 2
Use an int.
+ 1
well I used it
+ 1
int i;
for(i=0;i<=100;i++)
{
System.out.println(i);
}
below is my simple program but I can't get output for this what is answer
+ 1
thanks I'll try it