Skip to main content

Factors of a number

#include <stdio.h> int main() { int n; printf("Enter the value of n : "); scanf("%d" , &n ); printf("\nThe factors of %d are : \n\n", n ); for(int i = 1 ; i <= n; i++ ) { if( n % i == 0 ) printf("%d ", i); } }



Comments