Needing Help on Vector Exercises in C

0

Why are not you displaying the 15 numbers? And how do you include 3 numbers at the beginning of this vector?

int main()
{

   int v[30];
   int i,x;

   for(i=0; i < 15; i++)
   {
       printf("Digite 15 numeros");
       scanf("%d", &v[i]);
   }
   printf("%d Os numeros escolhidos foram:", v[i]);

}
    
asked by anonymous 12.06.2018 / 02:12

1 answer

1

Just by putting v[i] in print, you can not print because it is not indicating what index i is. To print all you must make a loop the same way you did to read, but with a printf instead of scanf:

for(i=0; i < 15; i++){
    printf("%d\n", v[i]);
} 

I just did that and it rolled. (I also added the include <stdio.h> at the beginning of the file but I suppose you have already placed it.)

    
12.06.2018 / 02:20