Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <ctype.h>
- #include <string.h>
- int main(){
- int min1 = 0x7fffffff, min2 = 0x7fffffff, cur;
- for(;;){
- scanf("%d", &cur);
- if(cur < 0){
- break;
- }
- //cur>0
- if(cur < min1){
- min2 = min1;
- min1 = cur;
- }
- else if(cur < min2){
- min2 = cur;
- }
- }
- if(cur == -1){
- printf("%d\n", min1);
- }
- else if(cur == -2){
- printf("%d\n", min2);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement