#include <stdio.h>
int main(void) {
int arr[5]={80,60,70,90,10};
int i, large1, large2;
large1 = large2 =1;
for(i=0; i<5; i++){
if(arr[i] >large1)
{
large2 = large1;
large1 = arr[i];
}
else if(arr[i]> large2)
large2 = arr[i];
}
printf("largest = %d\n 2nd largest = %d", large1, large2);
return 0;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.