C program to find factors of any number
C program to find factors of any number
So, I was just sitting at my chair wondering about new posts in my blog. I thought about a simple C program which outputs the factors of any number. The source code is given below. Please share if you find it useful.
int main(){
int no,i;
printf("Enter a number\n");
scanf("%d",&no);
printf("Factors are:\n");
for(i=2;i<=no;i++){
if(no%i==0){
printf("%d\n",i);
}
}
}
Stay tune for future posts.
Comments
Post a Comment
Add your comment here...