Loading...
Engaged employer
Write a simple function that prints out all factors of a given number n.
Anonymous
for (int i = 1; i <= n; i++) { if (n % i == 0) then print out i }
#include int main() { using namespace std; try { int product = 0; cout > product; for (int i = 1; i <= product; i++) { if (product % i == 0) { cout << i << " is a factor of " << product << endl; } } } catch (exception &ex) { cout << ex.what() << " in main." << endl; return EXIT_FAILURE; } return EXIT_SUCCESS; }
Stay ahead in opportunities and insider tips by following your dream companies.
Get personalised job recommendations and updates by starting your searches.
Get actionable career advice tailored to you by joining more bowls.
Check out your Company Bowl for anonymous work chats.