diogoAlves

IFF/Introdução à Programação/Slide/Pag 47/Ex 1

Feb 24th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. //IFF - Introdução à Programação
  2. //Slide - Página 47 - Exercício 1
  3. #include<stdio.h>
  4. #include<locale.h>
  5.  
  6. int main(){
  7.     setlocale(LC_ALL,"Portuguese");
  8.     int vetor[10], maior, menor, valorTotal;
  9.     for(int i=0;i<10;i++){
  10.         printf("Entre com o %dº valor do vetor: ", i+1);
  11.         scanf("%d",&vetor[i]);
  12.         if(i==0) menor=vetor[i];
  13.         if(vetor[i]>maior) maior=vetor[i];
  14.         if(vetor[i]<menor) menor=vetor[i];
  15.         valorTotal+=vetor[i];
  16.     }
  17.     printf("O maior valor do vetor foi: %d\nO menor valor do vetor foi: %d.\nA média dos valores do vetor foi %d.",maior, menor, valorTotal/10);
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment