Need a project done?

C++ Programming Developer

Search This Blog

Seperate 5 digits in C++


//Program to seperate 5 digits in C++

#include <iostream>
using namespace std;

int main()
{
int x;
cin>>x;

int a,b,c,d,e;

a = x/10000;
b = (x/1000)%10;
c = (x/100)%10;
d = (x/10) %10;
e = x%10;

cout << "First: "<<a<<endl;
cout << "Second: "<<b<<endl;
cout << "Third: "<<c<<endl;
cout << "Fourth: "<<d<<endl;
cout << "Fifth: "<<e<<endl;


return 0;
}

No comments:

Post a Comment

"Don't let anyone ever make you feel like you don't deserve what you want."