Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //assignment 3
- #include <iostream>
- using namespace std;
- int number, counter = 2;
- int main()
- {
- char again = 'y';
- while (again == 'y')
- {
- //asks for integer
- cout << "Enter an integer: " << endl;
- cin >> number;
- //math and loop
- do
- {
- if (number % counter == 0)
- {
- cout << "Your number is divisible by: " << counter << endl;
- }
- counter++;
- } while (counter <= 9);
- cout << "\nWould you like to go again? y/n" << endl;
- cin >> again;
- again = tolower(again);
- //exit
- counter = 2;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement