Write a C program to find the second largest integer in a list of integers.
Program Code:
#include<stdio.h>
void main()
{
int a[10],i,j,t;
printf(" enter 10 nos\n");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
for(i=1;i<10;i++)
{
for(j=0;j<10;j++)
{
if(a[j]>a[i])
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
printf("\n second largest no.=%d",a[8]);
}
Post A Comment:
0 comments: