Monday, 10 February 2014

2

int main()
02{
03int num;
04cout << "Please enter an integer between 1,000 and 1,000,000 without commas: ";
05cin >> num;
06 
07int modulus = num%1000;
08if (num >= 1000 && num <1000000) {
09cout << (num-modulus)/1000 << ',';
10if (modulus < 100) cout << '0';
11if (modulus < 10) cout << '0';
12cout << modulus << endl;
13}
14else cout << "your number is not valid" << endl;
15 
16return 0;
17}

No comments:

Post a Comment