C Plus Plus
Program to Split 5 Digit Number
One
of my friend is continuously requesting me to write a C++ program which will
take the 5 digit number from the user and then split each its digit.
So,
I come up with this program this will exactly do
This
C++ program will ask the user to enter a five digit number and then split this
number in five digits.
C Plus Plus
Program to Split 5 Digit Number
Program Code
#include<iostream>
using
namespace std;
int
main()
{
int a,b,c,d,e,f;
cout<<"Enter a five digit
number\n";
cin>>a;
b=a/10000;
c=a%10000/1000;
d=a%1000/100;
e=a%100/10;
f=a%10;
cout<<b<<" "<<c<<" "<<d<<" "<<e<<" "<<f<<" ";
return 0;
}
C Plus Plus
Program to Split 5 Digit Number
Program
Output
This
is the screen shot of the output of this program. You can clearly see that the
5 digit number is separated.
That’s
it.
Thanks!
If
you have trouble in any sort of program. Please contact us, our team of experts
will help you instantly.
Post a Comment
Feel Free to Comment Us