Advertisement
weldisalves

Lista 04 - exercício 02

Jun 18th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2. #define MAX 20
  3.  
  4. //2. Leia um conjunto de 20 valores inteiros e em seguida exiba-os na ordem inversa do que foram digitados.
  5.  
  6. int main()
  7. {
  8.     int valores[MAX],i;
  9.  
  10.     for(i=0;i<MAX;i++)
  11.     {
  12.         printf("\n Digite um valor: ");
  13.         scanf("%d",&valores[i]);
  14.     }
  15.  
  16.     printf("\n Valores na ordem inversa: \n");
  17.     for(i=MAX-1;i>=0;i--)
  18.     {
  19.         printf("%d ",valores[i]);
  20.     }
  21.     getch();
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement