Program in C++, C to display the reverse of a number with the flowchart.
In this tutorial, we will learn about the followings;
- Flowchart of the program to display the reverse of a number
- Program in C++ to display the reverse of a number
- Program in C to display the reverse of a number
Flowchart for the reverse of a number using for loop

Program in C++ to display the reverse of a number using for loop
#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.


Flowchart for the reverse of a number using Do While loop
Program to display the reverse of a number using DO WHILE loop [C++]
Write a Program to print a string in reverse order using a do-while loop.
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
string str="i am a girl";
int i=str.length()-1;
do
{
cout<<str[i];
i--;
}
while (i>=0);
system("pause");
return 0;
}
Excercise
Find the possible mistakes in the following Shamil’s Flow Table of the program of Multiplication Table vertically from 1 to 2.
| Loop | Which line will execute |
| I=1 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
|
| I=2 (True) | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
8,9,10,11,12,13 |
| I=3 (True) | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
8,9,10,11,12,13,8,9,10,11,12,13
|
| I=4 (False) | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
8,9,10,11,12,13,8,9,10,11,12,13 14,15,16 |
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


