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.

#include<stdio.h>
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

Popular posts from this blog

How to calculate age using C program

ISRO develops India's fastest supercomputer - the GPU-architecture based SAGA-220.

Restart Windows Explorer manually after Explorer crashes