Code Below:
import java.util.*;
class reverse
{
public static void main()
{
Scanner s=new Scanner(System.in);
int i;
int arr[]=new int[10];
System.out.println("ENTER 10 NOS.");
for (i=0;i< 10;i++)
arr[i]=s.nextInt(); //array input loop
System.out.println("Reversed Array:");
for (i=9;i>=0;i--)
System.out.println(arr[i]); //reversal loop
for (i=0;i< 10;i++)
sum=sum+arr[i]; //summing loop
System.out.println(sum);
}
}
Code Below:
import java.util.*;
class rainfall
{
public static void main()
{
Scanner s=new Scanner(System.in);
double sum=0.0; int i;
double arr[]=new double[7];
System.out.println("ENTER THE RAINFALL OF A WEEK");
for(i=0;i< 7;i++)
arr[i]=s.nextDouble();
for(i=0;i< 7;i++)
sum=sum+arr[i];
System.out.println("AVERAGE RAINFALL OF A WEEK="+sum/7);
}
}