answersLogoWhite

0

#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

14y ago

What else can I help you with?

Related Questions

Write the number whose factors sum to 12?

The number is 6.


How do you write a program in qbasic to input 64751315 to sum?

In QBASIC, you can write a simple program to input the number 64751315 and sum its digits as follows: DIM sum AS INTEGER sum = 0 INPUT &quot;Enter a number: &quot;; number FOR i = 1 TO LEN(number) sum = sum + VAL(MID$(number, i, 1)) NEXT PRINT &quot;The sum of the digits is &quot;; sum This program prompts the user to input a number, iterates through each digit, converts it to an integer, and adds it to the total sum, which is then printed out.


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


What is the sum of the factors in -14?

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


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


How do you write a program in Q basic to print the sum of the even numbers from 1 to 20 in reverse order?

To write a program in QBasic that prints the sum of the even numbers from 1 to 20 in reverse order, you can follow these steps: DIM sum AS INTEGER sum = 0 FOR i = 20 TO 2 STEP -2 sum = sum + i NEXT i PRINT &quot;The sum of even numbers from 1 to 20 is: &quot;; sum This program initializes the sum to zero, iterates from 20 down to 2 in steps of -2 (to capture even numbers), adds each even number to the sum, and finally prints the result.