+ 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 ( ); }
1 Resposta
0
Why no answers?