Program to get the input of two or higher digit integer number and display in reverse order.

Problem Analysis:

The problem is to get the input of two or higher digit integer number and display in reverse order.

i.e. digit = num%10;

rev= rev*10 + digit;

num= num/10;


Input variables               Processing variables                     Output variables                         Necessary header files


num(long int)                       digit=num%10;                          rev(long int)                              stdio.h

rev=0(long int)                     rev=rev*10+ digit;                                                                       conio.h

digit(int)                               num=num/10;


 

Algorithms:

1.start

2.Define :num,rev=0,digit.

3.Input : num by the user.

4.While (num!=0)

digit=num%10;

rev=rev*10+digit;

num=num/10

5.Print the output as rev.

6.End.

 

Codes:

Outputs :

Compiling  ,  Debugging  and Testing

Enter number: 589

so reverse is 985

 

About Programmingfaster

We the teams of programming faster managed to provide an effective information about the codes of different programming languages.Hope you will learn and understand the codes fast and easy. It's absolutely free, expanding and precise. Our main target is to help those new starters and aid them as far as possible to pave their future in the area of programming. Hoping support and recommendations!
This entry was posted in C, precise examples and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *