Wednesday, 9 January 2013

program to print numbers separately given from user

//program to print numbers separately given from user. 
e.g 1234
      1,2,3,4 in any order...

‎#include<iostream.h>
#include<conio.h>
void main ()
{ clrscr();
int a,b,c;
cout<<"enter a number";
cin>>a;
b=a%10;
c=a/10;
cout<<"1st="<<b<<endl;
b=c%10;
c=c/10;
cout<<"2nd="<<b<<endl;
b=c%10;
c=c/10;
cout<<"3rd="<<b<<endl;
b=c%10;
c=c/10;
cout<<"4th="<<b<<endl;
b=c%10;
c=c/10;
cout<<"5th="<<b<<endl;
getch();

}

No comments:

Post a Comment