+ 1

Write a program in c to input 10 data in an array and print 2nd largest number.

Attempt: include<stdio.h> #include<conio.h> int main() { int arr[10]={1,2,3,3,2,5,6,7,8,4},i,j,a; for (i=0;i <10;i++) { for (j=i+1;j <10;j++) { if (arr[i]>arr[j]) { a=arr[i]; arr[i]=arr[j]; arr[j]=a; } } } printf("%d",arr[i]); getch ( ); }

21st Jun 2018, 5:03 PM
ALOK GOLDY
ALOK GOLDY - avatar
1 Antwort
0
Why no answers?
5th Jun 2021, 11:41 AM
Rishi
Rishi - avatar