OCJP

Highest Run of Players (Maximum from Single Dimension Array)

Here is the example for finding out the Maximum Value from a Single Dimension Array. Here we have an array of 7 elements and founded nos of Hundreds and Fifties as well as maximum (Highest) runs from an Array.

#include<stdio.h>
#include<conio.h>
void main()
{
int run[7];
int i,sum=0,max,f=0,h=0;
clrscr();
printf("\nEnter Runs of 7 Players :");
for(i=0;i<7;i++)
{
printf("\nEnter Run :");
scanf("%d",&run[i]);
sum=sum+run[i];
if(run[i]>=50 && run[i]<=100)
f++;
else if(run[i]>=100)
h++;

}

max=run[0];

for(i=0;i<7;i++)
{
printf("\nRun [%d] is %d",i,run[i]);
if(run[i]>max)
max=run[i];

}
 printf("\n total run is sum %d",sum);
 printf("\nFifty %d Hundreds %d and Highest %d",f,h,max);
getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *


Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.
× How can I help you?
Comodo SSL