gpsgiraldi

2024_vet_tam_indef_auto_fill_saida_formal

May 22nd, 2024 (edited)
569
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | Source Code | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int n,i;
  6.         printf("Insira o tamanho do vetor\n");
  7.         scanf("%i",&n);
  8.     int vet[n];
  9.         for(i=0;i<n;i++){
  10.             vet[i]=(i+1);
  11.         }
  12.         printf("Vetor = {");
  13.     for(i=0;i<(n-1);i++){
  14.         printf("%i ",vet[i]);
  15.     }
  16.     printf("%i}",vet[(n-1)]);
  17.     return 0;
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment