Thursday, July 19, 2012

How to reverse a numbers input by user

, No comments
Source Code:
#include<stdio.h>
#include<conio.h>
    void main()
       {
           long number,n1,n2,n3,n4,n5,n6,n7,n8,n9;
           
           clrscr();
           printf("\n Enter A Five Digit Number :: ");
           scanf("%ld",&number);
           n1=number%10;
           n2=number/10;
           n3=n2%10;


           n4=n2/10;
           n5=n4%10;
           n6=n4/10;
           n7=n6%10;
           n8=n6/10;
           n9=n8%10;

           
  printf("\nReverse Number is %ld%ld%ld%ld%ld",n1,n3,n5,n7,n9);
  printf("\n Log on to http://www.whatiLearn.info For More "); 
           getch();
       }





Input:
Enter A Five Digit Number :: 12365
Output:
Reverse Number is:: 56321
Log on to http://www.whatiLearn.info For More 



0 comments:

Post a Comment

Entries RSS Comments RSS

Sample Text

Pages


Copyright © Lovely Codes
Powered by Blogger
Distributed By Free Blogger Templates | Design by N.Design Studio
Blogger Theme by Lasantha - PremiumBloggerTemplates.com