i have searched many websites for this question.They are doing it by some different approach.
This code is just not giving output if i input first element of array as largest i.e. a.
i think some minor change is required.
can anyone please tell me......
printf("enter number of elements you want in array");
if(a[i]>largest2 && a[i]<largest1)
printf("First and second largest number is %d and %d ",largest1,largest2);
It looks like you're new here. If you want to get involved, click one of these buttons!
largest2 = a;
Ignore the above, too late to change it. The real answer below.
Don't assign initial min/max values directly from input. Use arbitrary large/small number instead.
And second for loop should have