+ 2

You are given a sequence of integers as input, terminated by a -1. (That is, the input integers may be positive, negative or 0.

A -1 in the input signals the end of the input).-1 is not considered as part of the input. Find the second largest number in the input. You may not use arrays. the above paragraph is in the question itself due to insufficiency in the above it's written here and below is it's c code. Answer: #include<stdio.h> void main( ) { int x,y,z; scanf("%d",&y); for(;;) { scanf("%d",&z); if(y==z) continue; if(y>z) { x=z; z=y; y=x; break; } break; } for(;;) { scanf("%d",&x); if(x==-1) break; if(x>z) { y=z; z=x; continue; } if(x>y) { if(x==z) { continue; } else y=x; } } printf("%d",y); }

17th Jun 2018, 2:32 AM
Noman Aasif
Noman Aasif - avatar
2 Respuestas
0
Sorry, I don't quite understand your question. Please be more specific to what you are asking.
17th Jun 2018, 2:37 AM
Andre Daniel
Andre Daniel - avatar
0
If you've written this as a means of helping someone out in the future, it would be better to post it as a code in the codes section, not the questions section.
17th Jun 2018, 2:40 AM
Andre Daniel
Andre Daniel - avatar