+ 1

How can I make the code have a for for N numbers and not for 6

https://code.sololearn.com/chJC6kkclYVy/?ref=app

9th Feb 2020, 9:29 PM
Young Money
Young Money - avatar
2 Answers
+ 1
I don't really understand the language, but I think you can try to use a loop, a for-loop will do the job just fine 👍 Assuming we have a variable <N>, with value of 6 (for example); // for input for(int i = 0, v; i < N; i++) { scanf("%d", &v); // read value apilar(&original, v); // push } // for copying from original -> aux for(int i = 0; i < N; i++) { apilar(&aux,desapilar(&original)); } // for printing elements for(int i = 0; i < N; i++) { printf("%i ",desapilar(&aux)); }
9th Feb 2020, 10:04 PM
Ipang
+ 1
Hi
11th Feb 2020, 7:06 PM
Isaiah Kwao