Advertisement
RafaelMonitor

Exercicio de repetição 20/03

Mar 20th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.01 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int a,i=1,entre=0,negativo=00;
  7.     float real,maior,menor,soma=0;
  8.     printf("Digite a quantidade de valores\n");
  9.     scanf("%d",&a);
  10.     while (i<=a)
  11.     {
  12.         printf("Digite o numero %d\n",i);
  13.         scanf("%f",&real);
  14.         if (i==1)
  15.         {
  16.             maior=real;
  17.             menor=real;
  18.         }
  19.         else if (maior<real)
  20.         {
  21.             maior=real;
  22.         }
  23.         else if (menor>real)
  24.        {
  25.            menor=real;
  26.        }
  27.        soma=soma+real;
  28.        if(real>5 && real<10)
  29.        {
  30.            entre++;
  31.        }
  32.        if(real<0)
  33.        {
  34.            negativo++;
  35.        }
  36.        i++;
  37.  
  38.     }
  39.     printf("\nA media e = %.2f",soma/a);
  40.     printf("\nO maior valor digitado foi = %.2f",maior);
  41.     printf("\nO menor valor digitado foi = %.2f",menor);
  42.     printf("\nA quantidade de valores entre 5 e 10 foi = %d",entre);
  43.     printf("\nA quantidade de valores negativos foi = %d",negativo);
  44.  
  45.  
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement