First ask the user how many numbers (num), up to 20, they wish to enter. Then pr
ID: 3631116 • Letter: F
Question
First ask the user how many numbers (num), up to 20, they wish to enter. Then prompt the user for num numbers, storing them in an array. Finally print the numbers in reverse, separated by a comma and a single space, on a single line.You should declare an array:
int numbers[20];
but use num to keep track of how many valid entries you have.
Constraints
Do not output a comma after the last number.
If the user enters an invalid number of entries, prompt them to try again.
Explanation / Answer
#include int main(void) { int numbers[20], num; do { printf("Enter a positive number less than 20: "); scanf("%d", &num); } while( num < 0 || num > 20); // Getting the numbers for(i = 0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.