#include <stdio.h>
      
      int factors() {
        int num, i;
        printf("Enter a positive integer: ");
        scanf("%d", &num);
        printf("Factors of %d are: ", num);
        for (i = 1; i <= num; ++i) {
          if (num % i == 0) {
            printf("%d ", i);
          }
        }
        return 0;
      }
      
      C language logo

      Factors of number

      Codiga's C Recipes

      Find all the positive factors of an integer entered by the user.

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.