How to compile a program in Java for natural numbers..I can compile in eclipse compilers but in sololearn compiler can't compile | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

28th Jul 2017, 1:10 AM
Pravinkumar D
Pravinkumar D - avatar
5 Answers
+ 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); } }
28th Jul 2017, 1:19 AM
Rrestoring faith
Rrestoring faith - avatar
+ 2
Use an int.
28th Jul 2017, 1:11 AM
Rrestoring faith
Rrestoring faith - avatar
+ 1
well I used it
28th Jul 2017, 1:12 AM
Pravinkumar D
Pravinkumar D - avatar
+ 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
28th Jul 2017, 1:14 AM
Pravinkumar D
Pravinkumar D - avatar
+ 1
thanks I'll try it
28th Jul 2017, 1:20 AM
Pravinkumar D
Pravinkumar D - avatar