Q:

Find Factor of a number using c++

0

Write a program to find the factor of a number

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#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

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Entering an array and printing its inverse using c... >>
<< Calculate the area and perimeter of a circle using...