Answer to Question #17817 in C++ for dhruvee

Question #17817
can you help me out in writing a program that reads an integer array having 5 elements .The program uses a function reverse() to reverse this array.Make suitable assumptions wherever required.
1
Expert's answer
2012-11-02T13:03:27-0400

int arrayofnumbers[5];
void reverse();
int main()
{
for(int i=0;i<5;i++){
printf("Enter number %d: ",(i+1));
scanf("%d",&arrayofnumbers[i]);
}
reverse();
int k=0;
scanf("%d",&k);
return 0;
}
void reverse(){
printf("Reverse numbers: ");
for(int i=4;i>=0;i--){
printf("%d ",arrayofnumbers[i]);
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS