// Zeinalipour-Yazti Demetrios // csyiazti // cs10xx - // Lab Sec#25-#39 // lab4 /* * This program asks the user for their first name and their * favorite number (1-12). Then it prints all values 1-50 replacing * all factors of their favorite number with their name. * */ #include #include using namespace std; void main() { string name; /* The users's first name */ int num; /* The users's ffavorite number */ cout << "\nPlease type your name: "; cin >> name; // validating user's input while (true) //start while1a { cout << "\nPlease type your favorite number (1-12): "; cin >> num; if (num>=1 && num<=12) { break; } else { cout << "Error# - Enter a number (1-12): " << endl; } } //end while1a for (int i=1;i<=50;i++) { if (i%num==0) { cout << name << endl << endl; } else { cout << i << endl << endl; } } }