+ 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); }
2 Antworten
0
Sorry, I don't quite understand your question. Please be more specific to what you are asking.
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.