{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

thoudigits2 - cin>> a if a==1 cout<<"The one...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> using namespace std; void main() { int ones,tens,hundreds,thousands, tenthousand, hundredthousand, num, sum, a; cout << "Enter Number:" ; cin >> num; ones=num%10; tens=num%100/10; hundreds=num%1000/100; thousands=num%10000/1000; tenthousand=num%100000/10000; hundredthousand=num%1000000/100000; cout <<"enter the desired number digit. choose from ones as 1,tens as 2,hundreds as 3,thousands as 4,tenthousand as 5, hundredthousand as 6.";
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cin >> a; if ( a==1 ) cout << "The one is "<<ones<<endl; else if ( a==2 ) cout << "The tens is "<<tens<<endl; else if ( a==3 ) cout << "The hundreds is "<<hundreds<<endl; else if ( a==4 ) cout << "The thousands is "<<thousands<<endl; else if ( a==5 ) cout << "The ten thousands is "<<tenthousand<<endl; else if ( a==6 ) cout << "The hundred thousand is "<<hundredthousand<<endl; }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online