Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

Program in C++, C to display the reverse of a number with flowchart

Program in C++, C to display the reverse of a number with the flowchart

In this tutorial, we will learn about the followings;

  1. Flowchart of the program to display the reverse of a number
  2. Program in C++ to display the reverse of a number
  3. Program in C to display the reverse of a number 

Flowchart of the program to display the reverse of a number

Program in C++, C to display the reverse of a number flowchart

Figure: Program in C++, C to display the reverse of a number flowchart.

Program in C++ to display the reverse of a number

#include <iostream>
#include <conio.h>
using namespace std;
 int main()
  {
   int Input_Numbers[55];
   int Reverse_Numbers[55];
   int num;
   int Number_of_elements;
   cout<<"How many elements you wnat to insert: ";
   cin>>Number_of_elements;
   cout<<"Enter any "<<Number_of_elements<<" elements in Array: ";
   for(int i=0; i<Number_of_elements ;i++)
   {
   cin>>Input_Numbers[i];
   }
   cout<<"Array fo reverse elements: ";

   for(int i=Number_of_elements-1, num=0; i>=0;i--,num++)
   {
    Reverse_Numbers[i]=Input_Numbers[num];
   }
   for(int i=0; i<Number_of_elements ;i++)
   {
   cout<<Reverse_Numbers[i];
   }
  getch();
  }

Output.

Program in C++, C to display the reverse of a number with flowchart

Figure: Program in C++, C to display the reverse of a number with a flowchart.

Program in C to display the reverse of a number 

#include <stdio.h>
#include <conio.h>

 int main()
  {
   int Input_Numbers[55];
   int Reverse_Numbers[55];
   int num,inc;
   int Number_of_elements;
   printf("How many elements you wnat to add: ");
   scanf("%d",&Number_of_elements);
   printf("Enter %d Numbers of your choice:",Number_of_elements);
   for(inc=0; inc<Number_of_elements ;inc++)
   {
   scanf("%d",&Input_Numbers[inc]);
   }
   printf("Array fo reverse elements: ");

   for(inc=Number_of_elements-1, num=0; inc>=0;inc--,num++)
   {
    Reverse_Numbers[inc]=Input_Numbers[num];
   }
   for(inc=0; inc<Number_of_elements ;inc++)
   {
   printf("%d",Reverse_Numbers[inc]);
   }
  getch();
  }

Output

Program in C++, C to display the reverse of a number with flowchart

Figure: Program in C++, C to display the reverse of a number with the flowchart.