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]);
}

Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: