Array handling programs
(Single dimensional array)
1. WAP to input 10 values into an array and display the square of each element of the array
Answers
Answered by
5
Question:-
WAP to input 10 values into an array and display the square of each element of the array.
Program:-
This is written in Java.
import java.util.*;
class Arrays
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter 10 elements in the array...");
int a[]=new int[10];
for(int i=0;i<10;i++)
a[i]=sc.nextInt();
System.out.println("These are the squares of all the numbers in the array...");
for(int i=0;i<10;i++)
System.out.println(a[i]*a[i]+"\t");
}
}
Answered by
1
Answer:
ھڈحصغئغگڈڈھڈبڈیڈدءڈبڈدءڈھڈدیڈںدءعہصھر ءع ءخء. و ڈ. ءوبخےعہبخ,کڈھشزںءقکیڈجددکخ ڈءڈ ڈع
Similar questions