Advertisement
Ancell_Kaizer

20150524RGR

May 24th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.91 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <conio.h>
  4. #include <locale.h>
  5.  
  6.  
  7. int main()
  8. {
  9.     setlocale(LC_ALL, "Russian");
  10.     int a[20], counter, max = -10000, min = 10000;
  11.     long long int srg = 1;
  12.     printf("Введите 20 произвольных действительных чисел:\n");
  13.     for (counter = 0; counter < 20; counter++)
  14.     {
  15.         do
  16.         {
  17.             scanf("%d", &a[counter]);
  18.             if (a[counter] < 0)
  19.             {
  20.                 printf("Введите положительное число.\n");
  21.                 continue;
  22.             }
  23.             if (a[counter] < min) min = a[counter];
  24.             if (a[counter] > max) max = a[counter];
  25.             srg = srg * a[counter];
  26.         } while (a[counter] < 0);
  27.     }
  28.     printf("\n\n\nМаксимальное число: %d\n", max);
  29.     printf("Минимальное число: %d\n", min);
  30.     printf("Среднее геометрическое введённых чисел: %d\n", srg);
  31.     system("PAUSE");
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement