434,640 Members | 2,095 Online
Need help? Post your question and get tips & solutions from a community of 434,640 IT Pros & Developers. It's quick & easy.

# How to output an array backward ?

 P: 4 The question asking me to output backward, is it the same meaning as inverse output?? this is what I've done so far : Expand|Select|Wrap|Line Numbers /*Q3) Develop a C program that inputs a list of numbers, letting the user decide how many. Output the list backwards, but only output numbers greater than 20?*/   #include  #include    int main() {       int i,N;     int array[200];       printf("Input The Size of the array you wish:\n");     scanf("%d",&N);     printf("Input the array of size %d:\n",N);     for (i=0;i=0;i--)     if(array[i]>20)     printf("%d\n",array[i]);       return 0; }       any suggestion ? Thanks Nov 17 '10 #1

Develop a C program that inputs a list of numbers, letting the user decide how many. Output the list backwards, but only output numbers greater than 20.
My interpretation of these requirements is that your program must allow the user to enter any amount of numbers; then the program must print those same numbers back in reverse order (newest numbers first), being careful not to print any numbers less than or equal to 20.

That is, if the user enters these numbers:
• -10
• 0
• 10
• 100
• 20
• 30
• 40
• 50

The program must print:
• 50
• 40
• 30
• 100

It looks to me like your program does this. Are you having any problems with it? By the way, you ought to verify that 'N' is not greater than 200 (the size of 'array').

2 Replies

 Expert 100+ P: 2,400 Develop a C program that inputs a list of numbers, letting the user decide how many. Output the list backwards, but only output numbers greater than 20. My interpretation of these requirements is that your program must allow the user to enter any amount of numbers; then the program must print those same numbers back in reverse order (newest numbers first), being careful not to print any numbers less than or equal to 20. That is, if the user enters these numbers:-10 0 10 100 20 30 40 50 The program must print:50 40 30 100 It looks to me like your program does this. Are you having any problems with it? By the way, you ought to verify that 'N' is not greater than 200 (the size of 'array'). Nov 17 '10 #2

 P: 4 My problem is that i need to know if they mean by backward the same as inverse order, but from your words I realized that it is the same. Also You are right that I should verify that "N" is not greater than 200. thanks A lot Nov 17 '10 #3