0

Loops

How do i create a loop to print out the following sequence; 1) 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 In JAVA

3rd Nov 2018, 11:08 AM
Abass_J1
Abass_J1 - avatar
3 Réponses
+ 5
It is pretty easy, something like this will do it: public class Program { public static void main(String[] args) { for(int x=1; x<=10; x=x+1) { System.out.println(x*x); } } }
3rd Nov 2018, 11:23 AM
Paul
Paul - avatar
3rd Nov 2018, 11:24 AM
Mbrustler
Mbrustler - avatar
+ 1
Thanks guys soo much🙏
4th Nov 2018, 2:08 PM
Abass_J1
Abass_J1 - avatar