Page 212 - CA_Blue( J )_Class9
P. 212
5 int sq = n*n;
6 return sq;
7 }
8
9 void main(int a)
10 {
11 int r=square(a);
12 System.out.println("Square of "+ a+" is : "+r);
13 }
14 }
You will get the following output:
Some More Programs 21 st
Century #Coding & Computational Thinking
Skills
Program 1 Write a program to display the square of numbers from 1 to 10.
1 class SquareOfNumber
2 {
3 public static void main(String args[])
4 {
5 for (int i = 1; i <= 10; i++)
6 {
7 System.out.println("Square of: "+i+" is: "+(i*i));
210 Touchpad Computer Applications-IX

