Computer Science, asked by ss8956557, 1 month ago

Write a program to accept any number and display the factors of the number. Also display the sum of the factors.

Answers

Answered by pea4518977
1

Answer:

#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;

Explanation:

Answered by hussainanabu
0

Answer:

Write a program to accept any number and display the factors of the number. Also display the sum of the factors.

Similar questions