You are on page 1of 1

1: #include <iostream>

2: using namespace std;


3: int main()
4: {
5: //shafiq ur rehman 21011598-074
6: int number=9871;
7: int d1,d2,d3,d4,n1,n2,n3,n4;
8:
9: n1=number/1;
10: d1=n1%10;
11: cout<<"the number is "<<n1<<endl;
12: cout<<"the digit at unit place is "<<d1<<endl;
13: n2=number/10;
14: d2=n2%10;
15: cout<<"the number is "<<n2<<endl;
16: cout<<"the digit at ten place is "<<d2<<endl;
17: n3=number/100;
18: d3=n3%10;
19: cout<<"the number is "<<n3<<endl;
20: cout<<"the digit at hundred place is "<<d3<<endl;
21: n4=number/1000;
22: d4=n4%10;
23: cout<<"the number is "<<n4<<endl;
24: cout<<"the digit at thousand place is "<<d4<<endl;
25:
26: return 0;
27: }

You might also like