Assignment 12 - CSC 124 5.2 include using...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSC 124 10-24-2007 5.2 # include <iostream> using namespace std; int main () { int digit, num; cout << "Please enter a positive integer: " << endl; cin >> num; digit = num; while (num > 0) digit = num % 10; num = num / 10; cout << digit << endl; system ("PAUSE"); return 0; } 5.6 #include <iostream> using namespace std; int main () { int a, b, c, d, e; cout << "Please enter five integers: " << endl; cin >> a >> b >> c >> d >> e; if (a % 2 == 0) cout << a << endl; if (b % 2 == 0) cout << b << endl; if (c % 2 == 0) cout << c << endl; if (d % 2 == 0) cout << d << endl; if (e % 2 == 0) cout << e << endl; system ("PAUSE");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
return 0; } 5.8 # include <iostream> using namespace std; int main () { int num, temp, total, digit; cout << "Please enter a positive integer: "; cin >> num; cout << endl; temp = num; total = 0; while (num > 0); total = total + num % 10; num = num / 10; cout << "The total of the digits = " << total << endl; if (total % 11 == 0) cout << temp << " is divisible by 11." << endl;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 4

Assignment 12 - CSC 124 5.2 include using...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online