AR1
QUESTION DESCRIPTION Ramu and somu played a number game . Ramu asked somu to generate a Program to find the largest two numbers from n elements in an array and then calculate and display their average. Mandatory to declare the variable names are "int array[MAX], i" TEST CASE 1 INPUT 5 2 5 6 4 7 OUTPUT 6.5 TEST CASE 2 INPUT 7 2 5 6 4 7 10 4 OUTPUT 8.5 #include <stdio.h> int main() { int MAX =50; int array[MAX], i, largest1, largest2; int n,j,temp; float mean,sum; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&array[i]); for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(array[i]<array[j]) { temp=array[i]; array[i]=array[j]; array[j]=temp; } } } largest1=array[0]; largest2=array[1]; sum=largest1+largest2; mean=(sum)/2; printf("%.1f",mean); return 0; }