bsc

Comprehensive codebase and coursework for the 4-year B.Sc. Computer Science Honours degree (WBSU)

git clone https://github.com/notamitgamer/bsc.git
· rebuilt hourlyOpen on GitHub
root / semester_1 / tuition-c / P039.c

P039.c (353B)


      1 /* Write a program to print all the factors of a postive integer */
      2 
      3 #include <stdio.h>
      4 
      5 int main()
      6 {
      7     int num, i;
      8     printf("Enter a number : ");
      9     scanf("%d", &num);
     10     printf("\nFactors of %d : ", num);
     11     for (i = 1; i <= num / 2; i++)
     12     {
     13         if (num % i == 0)
     14         {
     15             printf("  %d", i);
     16         }
     17     }
     18     return 0;
     19 }