Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Reverse Traversing Of Four Digit No........

 Program print the input number , in right to left order (means  reverse traversing)

note: user can only put four digit number , if you want to insert more number leave message ....





Source Code:-

#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
  int n,a,b,c,d;
  cout<<"Reverse Traversal by Tarun Rawat\n";
  cout<<"Enter four digit number \n";
  cin>>n;
  if(n!=0)
   { a=n%10;
     b=n/10%10;
     c=n/100%10;
     d=n/1000%10;
     cout<<a<<b<<c<<d;
   }
getch();
}

No comments:

Post a Comment

Blogger Widgets

Find Us On Google, Just type - way2cplusplus -

If you have any questions on implementing or understanding this C++ Program , shoot me a comment and I'll be glad to help! :) :)