Write program to generate the sequence 1 4 9 16 25 36 49 64 81 100 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Write program to generate the sequence 1 4 9 16 25 36 49 64 81 100

Need hels sir/madam

30th Jan 2018, 2:57 AM
tolites
3 Answers
+ 19
for (int a=1;a <=10;a++) System.out.print(a*a+" "); //n^2
30th Jan 2018, 3:18 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 6
Here's another way in Python: For y in range(11): print(y * y)
30th Jan 2018, 3:20 AM
Faisal
Faisal - avatar
+ 1
public class ForEachExample {   public static void main(String[] args) {       int arr[]={12,23,44,56,78};        for(int i:arr){           System.out.println(i);       }   }   }  
30th Jan 2018, 6:13 AM
Tim Millar
Tim Millar - avatar