Watch all the answers in my youtube channel “CSE GURUS”. Video name is “Top 100 C mcqs”. #csegurus

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Sir this is to find second largest number but its showing an error can u pls help me
include<stdio.h>
int main()
{
int n, a[67], i, large, large2;
printf("enter no of elements in array");
scanf("%d", &n);
for(i=0;i<n;i++)
{
printf("enter element");
scanf("%d", &a[i]);
}
for(i=0;i<n;i++)
{
printf("%d", a[i]);
}
large=a[0];
for(i=0;i<n;i++)
{
if(a[i]>large)
large=a[i];
}
large2=a[0];
for(i=0;i<n;i++)
{
while(a[i]!=large)
{
if(a[i]>large2)
large2=a[i];
}
}
printf("second largest number is %d", large2);
}

Goldenpillavlogs