that_one_nigga_you_k

arrays e pá

Oct 21st, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3.  
  4. using namespace std;
  5.  
  6. int main(int argc, char** argv) {
  7.    
  8.     int x[10];
  9.     int y;
  10.     int soma;
  11.     int maior;
  12.     int menor;
  13.     float md;
  14.     float mdn;
  15.    
  16.     y = 0;
  17.    
  18.     for(y;y<10;y++){
  19.         cout<<"digite um numero ["<<y<<"]: ";
  20.         cin>>x[y];
  21.     }
  22.    
  23.     maior = x[0];
  24.    
  25.     for(y=0;y<10;y++){
  26.         if(x[y]>maior){
  27.             maior=x[y];
  28.         }
  29.     }
  30.    
  31.     menor = x[0];
  32.    
  33.     for(y=0;y<10;y++){
  34.         if(x[y]<menor){
  35.             menor=x[y];
  36.         }
  37.     }
  38.    
  39.     mdn=(maior+menor)/2;
  40.     soma = soma + x[y];
  41.     md = soma/10;
  42.    
  43.     cout<<"o maior numero é: "<<maior<<endl;
  44.     cout<<"o menor numero e: "<<menor<<endl;
  45.     cout<<"a media deles e: "<<mdn<<endl;
  46.     cout<<"a media de todos e: "<<md<<endl;
  47.    
  48.     getch();
  49.     return 0;
  50. }
Add Comment
Please, Sign In to add comment