Program for Reverse an array | Placement Preparation Question

Write a program to reverse an array or string

Get All TCS CodeVita Questions with Solution

Problem statement:-

Given an array (or string), the task is to reverse the array/string.

Examples : 

Input  : arr[] = {1, 2, 3}

Output : arr[] = {3, 2, 1}

Input :  arr[] = {4, 5, 1, 2}

Output : arr[] = {2, 1, 5, 4}

400+ Coding Questions With Solution[ 110% Placement ]

Source Code of Reverse an Array:

using namespace std;
int main(){
    int n,c=0,temp;
    cout<<"enter number of element\n";
    int ar[n];
     cout<<"enter "<<n<<" element\n";
    for(int i=0;i<n;i++){

    for(int i=n-1;i>=n/2;i--){
        ar[i]= ar[c];
        ar[c]= temp;
    cout<<"After Reverse\n";
    for(int i=0;i<n;i++){
        cout<<ar[i]<<", ";

The output of Reverse an Array:

Must Read:-

Final Word:-

In this article, We have given to you the PPT file of the 3D Internet Seminar. We hope you like it

If This post helps you a little bit then please share this post with your friends. For more Computer and programming Related Tips and tricks, please

Follow us on Facebook
Subscribe us on Youtube
Follow us on Instagram
Follow us on Pinterest
follow us on Telegram

Don't forget to share how you like this Content in the comment below. If you have any doubt or suggestion then please write in the comment section below, we will love to hear from you.

                               Thank you.

                                        ( नमस्ते )



1 comment:

  1. When these preservation techniques are accomplished, molds are in a position to} be put back into service rapidly and simply. Lasers will burn off mildew contaminants and mirror off the clear steel floor. While typical sand blasting media would injury a mildew floor, soft plastic media precision machining blasting cleans the mildew floor without damaging floor texture and polish. Whether we use aluminum or steel to make your mildew, ICOMold makes use of cutting-edge CNC machining and electrical machining to fulfill your exact specifications. Are you looking for new methods to make sure the longevity of your molds?


Do not add any link in the comments.
For backlink, contact us.

Powered by Blogger.