P039.c (489B)
1 /* 2 * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025 3 * Repo: https://github.com/notamitgamer/bsc 4 * License: MIT 5 */ 6 7 /* Write a program to print all the factors of a postive integer */ 8 9 #include <stdio.h> 10 11 int main() 12 { 13 int num, i; 14 printf("Enter a number : "); 15 scanf("%d", &num); 16 printf("\nFactors of %d : ", num); 17 for (i = 1; i <= num / 2; i++) 18 { 19 if (num % i == 0) 20 { 21 printf(" %d", i); 22 } 23 } 24 return 0; 25 }