language: C++ 4.7.2 (gcc-4.7.2)
date: 224 days 9 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include<iostream> 
using namespace std; 
int main() { 
        int first3, middle3, last3; 
        int original, temp, first, second,third, fourth, first1, second1, third1, fourth1;
        cout<<"enter a 7-9 digit number"<<endl;
        cin>>original;
        temp=original/1000;
        cout <<"temp= "<< temp<< endl;
         last3=original%1000;
         cout << "last3= "<< last3 << endl;
         first=last3/10;
         cout <<"first= "<< first << endl;
         second=last3%10;
         cout <<"second= " <<second << endl;
         third=first/10;
         cout <<"third= "<< third << endl;
         fourth=first%10;
         cout <<"fourth= "<< fourth << endl;
         first3=temp/1000;
         cout <<"first3= "<< first3 << endl;
         middle3=temp%1000;
         cout <<"middle3= "<< middle3 << endl;
         first1=middle3/10;
         cout <<"first1= "<< first1 << endl;
         second1=middle3%10;
         cout <<"second1= "<< second1 << endl;
         third1=first1/10;
         cout <<"third1= "<< third1 << endl;
         fourth1=first1%10;
         cout <<"fourth1= "<< fourth1 << endl;
         cout<<"the number with a comma is "<<endl;
         cout<<first3<<","<<first1<<second1<<third1<<","<<first<<second<<third<<endl;
         cout<<first3<< ","<<middle3<<","<< last3<< endl;
         return 0;
         }