Advertisement
andre_qramos

PROVA - FOR - 4A

Sep 28th, 2020
1,544
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cstdio>
  4. #include <cmath>
  5. #include <stdlib.h>
  6. #include <float.h>
  7. using namespace std;
  8.  
  9. int main() {
  10.     int quantidade;
  11.     double num;
  12.     double menor_altura = DBL_MAX;
  13.     double maior_altura = DBL_MIN;
  14.     int i;
  15.     cin >> quantidade;
  16.     for(i = 0; i < quantidade; i++) {
  17.         cin >> num;
  18.         if(num < menor_altura)
  19.             menor_altura = num;
  20.         if(num > maior_altura)
  21.             maior_altura = num;
  22.     }
  23.     printf("Menor altura: %.2f\n", menor_altura);
  24.     printf("Maior altura: %.2f\n", maior_altura);
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement