Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include <conio.h>
- #include <locale.h>
- int main()
- {
- setlocale(LC_ALL, "Russian");
- int a[20], counter, max = -10000, min = 10000;
- long long int srg = 1;
- printf("Введите 20 произвольных действительных чисел:\n");
- for (counter = 0; counter < 20; counter++)
- {
- do
- {
- scanf("%d", &a[counter]);
- if (a[counter] < 0)
- {
- printf("Введите положительное число.\n");
- continue;
- }
- if (a[counter] < min) min = a[counter];
- if (a[counter] > max) max = a[counter];
- srg = srg * a[counter];
- } while (a[counter] < 0);
- }
- printf("\n\n\nМаксимальное число: %d\n", max);
- printf("Минимальное число: %d\n", min);
- printf("Среднее геометрическое введённых чисел: %d\n", srg);
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement