Write a program to accept any number and display the factors of the number. Also display the sum of the factors.
Answers
Answered by
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
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