#include<iostream>
using namespace std;
int main()
{
int x=0;
int i;
int y;
int z;
int a;
int d;
int c;
int b;
cout<<"enter a four digit number:";
cin>>x;
a=x%10;
y=x/10;
b=y%10;
z=y/10;
c=z%10;
d=z/10;
if(d>9)
{
cout<<"number is not 4 digit";
}
else if(d==0)
{
cout<<"number is not 4 digit";
}
else
{
cout<<d<<endl;
cout<<c<<endl;
cout<<b<<endl;
cout<<a<<endl;
}
return 0;
}
************************
output:
using namespace std;
int main()
{
int x=0;
int i;
int y;
int z;
int a;
int d;
int c;
int b;
cout<<"enter a four digit number:";
cin>>x;
a=x%10;
y=x/10;
b=y%10;
z=y/10;
c=z%10;
d=z/10;
if(d>9)
{
cout<<"number is not 4 digit";
}
else if(d==0)
{
cout<<"number is not 4 digit";
}
else
{
cout<<d<<endl;
cout<<c<<endl;
cout<<b<<endl;
cout<<a<<endl;
}
return 0;
}
************************
output:
Comments
Post a Comment