C
Programming and Technical
Programming
Program
Find out the second largest value in an array ?
example
array={10,20,70,30,40,90,60}
output=70
Read Solution (Total 5)
-
- first sort all elements of array using any sorting method . then print array[1].
happy coding :)
- 10 years agoHelpfull: Yes(4) No(3)
- #include
int main()
{
int array={10,20,70,30,40,90,60}
int i,First_max,Second_max;
for(i=0;iFirst_max)
{
Second_max=First_max;
First_max=a[i];
}
}
printf("%d",Second_max);
return 0;
} - 10 years agoHelpfull: Yes(1) No(5)
- #include
void main(){
int array[7]={10,20,70,30,40,90,60};
int first_max,sec_max,i,pos;
first_max=array[0];
for(i=1;i - 10 years agoHelpfull: Yes(1) No(1)
- #include
#include
int main(){
int a[50],size,i,j=0,big,secondbig;
printf("Enter the size of the array: ");
scanf("%d",&size);
printf("Enter %d elements in to the array: ", size);
for(i=0;i - 10 years agoHelpfull: Yes(0) No(0)
- "FULL PROGRAM FOR PRODUCING THE DESIRED OUTPUT"
#include
#include
void main()
{
int max,i,a[]={10,20,70,30,40,90,60},*ptr, secmax;
max=a[0];
for(i=1;imax)
{
max=a[i];
ptr=&a[i];
}
}
/* printf("The maximum is:%dt",max); "PESUDO CODE FOR HELP"
printf("%dn",*ptr);
printf("%d",*ptr);*/
*ptr=0;
secmax=a[0];
for(i=1;isecmax)
{
secmax=a[i];
}
}
printf("The 2nd max is :%d",secmax);
getch();
}
- 10 years agoHelpfull: Yes(0) No(0)
C Other Question