Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void inputInt(void);
- main(){
- inputInt();
- }
- void inputInt(void){
- int input;
- int getOnes, getTens, getHundreds;
- int ones = 0, tens = 0, hundreds = 0;
- cout << "Type Six Integers . . . " << endl;
- for (int no = 1; no<=6; no++){
- cout << endl << no << ". "; cin >> input;
- getOnes = input%10;
- //cout << endl << getOnes << endl;
- getTens = input%100/10;
- //cout << endl << getTens << endl;
- getHundreds = input%1000/100;
- //cout << endl << getHundreds << endl;
- ones += getOnes;
- tens += getTens;
- hundreds += getHundreds;
- }
- cout << "Sum of all ones: " << ones << endl;
- cout << "Sum of all tens: " << tens << endl;
- cout << "Sum of all hundreds: " << hundreds << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement