Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void)
- {
- int num = 0;
- printf("enter numbers\n");
- scanf("%d" , &num);
- int maximum = num;
- int max = num;
- int cnt = 0;
- while(num != -999)
- {
- scanf("%d" , num);
- if(num>max)
- {
- if(num>=maximum)
- {
- max = maximum;
- maximum = num;
- }
- else
- {
- max = num;
- }
- }
- cnt = cnt+1;
- }
- if(cnt>1)
- {
- printf("the highest number is: %d\n" , maximum);
- printf("the second highest number is: %d\b" , max);
- }
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement