belongs to collection: collection of C++ quiz questions for beginners
Write a program to find the factor of a number
#include <iostream> using namespace std; int main(){ int number,i; cout<<"enter number:"; cin>>number; for(i=1;i<=number;i++){ if (number % i == 0) cout << i << " "; } }
Output:
enter number:15 1 3 5 15
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer