#include<stdio.h>
int main(){
int a[50],size,i,j=0,big,secondbig;
printf("Enter the size of the array: ");
scanf("%d",&size);
printf("Enter %d elements in to the array: ", size);
for(i=0;i<size;i++)
scanf("%d",&a[i]);
big=a[0];
for(i=1;i<size;i++){
if(big<a[i]){
big=a[i];
j = i;
}
}
secondbig=a[size-j-1];
for(i=1;i<size;i++){
if(secondbig <a[i] && j != i)
secondbig =a[i];
}
printf("Second biggest: %d", secondbig);
return 0;
}
i wrote above program using array. but i want to write without using array.
conditions are given a sequence of integers as input, terminated by a -1. i.e the input integers may be +ve, -ve or 0. A -1 in the input signals the end of the input. and -1 is not considered as part of the input.