ramontricolor12

LISTA 04 - Exercício 06

Jul 8th, 2013
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. /* CABEÇALHO
  2.    Arquivo: LISTA 04 - Exercicio 6.c
  3.    Objetivo: Exibir um numero ao lado de seu elemento simetrico em um vetor.
  4.    Autor(a): Ramon Borges
  5.  */
  6.  
  7. #include <stdio.h>
  8. #define MAX 5
  9. int main()
  10. {
  11.     int i, vetor[MAX], cont = 0;
  12.  
  13.     for(i = 0; i < MAX; i++)
  14.     {
  15.         do
  16.         {
  17.             printf("\nInforme o %d numero: ", i+1);
  18.             scanf("%d", &vetor[i]);
  19.         }while(vetor[i] < 0);
  20.  
  21.         if(vetor[i] == 0)
  22.             break;
  23.         cont++;
  24.     }
  25.  
  26.     for(i = 0; i < cont; i++)
  27.         printf("\n%d - %d", vetor[i], vetor[cont - i-1]);
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment