Tuesday, March 5, 2024

29. Print all factors of a number :—

29. Print all factors of a number :—


#include<stdio.h>

int main()

{

    int i,n,r;

    printf("enter a value of n ");

    scanf("%d",&n);

    for(i=1;i<=n;i++)

    {

        r=n%i;

        if(r==0)

        {

            printf("%d",i);

        }

    }

    return 0;

}


No comments:

Post a Comment