Answer to Question #13851 in C++ for Darryl kaye Abella Sanga

Question #13851
Write a program that will ask the user to enter a number and display all the factor of the number.
1
Expert's answer
2012-08-30T11:44:47-0400
#include<stdio.h>
void findfact(int num)
{
int i;

for(i=1;i<num;i++)
{
if(num%i==0)
printf("Factor for %d is
%d\n",num,i);
}
}
void main()
{
int a;
printf("\nEnter a
number:");
scanf("%d",&a);
findfact(a);
scanf("%d",&a);

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS