Answers for "find factors of a number in c"

C
0

find factors of a number in c

#include <stdio.h>
int main() {
    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;
}
Posted by: Guest on March-01-2022

Code answers related to "find factors of a number in c"

Code answers related to "C"

Browse Popular Code Answers by Language