Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void) {
- double mx, other;
- int ans = 1, input;
- printf("Write a number\n");
- input = scanf("%lf", &mx);
- if (input == 0 || input == EOF) {
- printf("No input\nNo MIN or MAX number");
- return -1;
- }
- printf("Putin more numbers\n");
- for (int i = 2; ; ++i) {
- input = scanf("%lf", &other);
- if (input == 0 || input == EOF) {
- printf("End of input\n");
- break;
- } else if (other > mx) {
- mx = other;
- ans = i;
- }
- }
- printf("Max Number: %f\n", mx);
- printf("First position: %d", ans);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement