gpsgiraldi

C_PROG_ex_maior_menor

Dec 13th, 2023
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | Source Code | 0 0
  1. // maior_menor;
  2.  
  3. #include <stdio.h>
  4.  
  5. int main()
  6. {
  7.   int valor, j, ma, me;
  8.   j = 1;
  9.   while(j <= 10){
  10.         printf("Insira um valor inteiro: \n");
  11.         scanf("%i", &valor);
  12.         if(valor > ma){
  13.             ma = valor;
  14.         }
  15.         else if(valor < me) {
  16.             me = valor;
  17.         }
  18.         j = j + 1;
  19.     }
  20.     printf("O menor valor inserido foi %i e o maior foi %i", me, ma);
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment