Advertisement
Kasoke

6 Exercicio

Jan 22nd, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<locale.h>
  3. int main(){
  4.  
  5.     setlocale(LC_ALL, "Portuguese");
  6.  
  7.     //variaveis
  8.     int *a;
  9.     int i;
  10.     int b;
  11.  
  12.     //entrada de vetores
  13.     printf("[QUANTIDADE DE VARIÁVEIS] = ");
  14.     scanf("%i", &i);
  15.     printf("----------------------------------------\n");
  16.    
  17.     a = (int*) malloc ( i * sizeof(int));
  18.  
  19.     //valor dos vetores
  20.     for ( b = 0; b < i; b++)
  21.     {
  22.         printf("[DEFINA OS VETORES] = ");
  23.         scanf("%i", &a[b]);
  24.         printf("----------------------------------------\n");
  25.     }
  26.    
  27.     //saida dos vetores
  28.     printf("[VETORES ESCOLHIDOS] = ");
  29.    
  30.     for (b = 0; b < i; b++)
  31.     {
  32.         printf("[%i]", a[b]);
  33.     }
  34.    
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement