Friday, June 26, 2020

Find Factors of the given number

Find Factors of the given number

PROGRAM:

#include<stdio.h>

int main()
{
    int i,n;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        if(n%i==0)
        {
            printf(" %d",i);
        }
    }

}

OUTPUT:

6                                                                                                                     
 1 2 3 6  

No comments:

Post a Comment