answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

void factor(int num)

{

int i,sum=0;

for(i=1;i<num;i++)

{

if(num%i==0)

{

sum=sum+i;

}

}

printf("Sum of the factor of %d is %d",num,sum);

}

void main()

{ int num;

printf("Enter the number=");

scanf("%d",&num);

factor(num);

getch();

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a C program for Sum of factors of a number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write the number whose factors sum to 12?

The number is 6.


Write a program to find the sum of all positive number and terminate the program when sum exceed 999?

int sum = 0; int n = 0; while( sum &lt;= 999 ) { sum += (++n); }


Write a Shell program to find the sum of cube of individual digits of a number?

no thanks


Writes a c program to find the sum of all integers between 1 and n?

Write a program to find the number and sum of all integers from 100 to 300 that are divisible by 11


How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


Write a program that will accept two numbers and find their sum anddifferences. If the sum is more than the difference, display the sum otherwisedisplay the difference. Pascal programming?

program SumAndDifference; var num1, num2, sum, difference: integer; begin write('Enter first number: '); read(num1); write('Enter second number: '); read(num2); sum := num1 + num2; difference := num1 - num2; if sum &gt; difference then written('The sum is greater: ', sum) else written('The difference is greater: ', difference); end. This program will prompt the user to enter two numbers, calculate their sum and difference, and then compare the two values. If the sum is greater than the difference, it will display the sum; otherwise, it will display the difference.


What is the sum of the factors in -14?

The sum of the factors of any negative number is zero.


What is it called when you write a number as a sum?

sum= answer of an addition question.. so the number of the sum is the answer.


Write a program to calculate the sum of the sequence number from 1 to n loop?

public static final int getSum(final int n) { int sum = 0; for(int i = 1; i &lt;= n; ++i) { sum += i; } return sum; }


Write a program to display table of five in unix?

sum=0 i=1 echo "Enter any number " read num while [ $i -le 10 ] do sum=`expr $num \* $i` i=`expr $i + 1` echo "Table of a number is " $sum done


What is the sum of all the factors of 30?

The sum of the positive whole-number factors of 30 is 72.


Write an algorithm for perfect number or not?

1. Get any no. 2. Find it factors. 3. Add its factor. 4. If sum of its factors is equal to itself then it is a perfect no. otherwise not