#include(stdio.h) // place this '<' & '>' instead of '(' & ')' before stdio.h
#include(conio.h)
void main( )
{
int no, sum=0, x;
clrscr( );
printf("Enter the required number :");
scanf("%d", &no);
for( x=1; x<=no; x++) {
if(no%x==0) sum=sum+x;
}
printf("\nSum of the factors of %d is: %d", no, sum);
getch( );
}
Output:-
Enter the required number: 10
Sum of the factors of 10 is: 18.
ie., 1+2+5+10 =18
Note:- If u have any doubt regarding this program or logic, please feel free to contact me.
Friday, February 20, 2009
Subscribe to:
Post Comments (Atom)
chutiya algo hai yeh...
ReplyDeletei would like to listen c programme classes online will u plzzzz help me
ReplyDeleteworst algo
ReplyDeleteCould you please explain, why you think the above program is not good.
DeleteRSVP.
Could you please explain, why you think the above program is not good.
DeleteRSVP.
Could you please explain, why you think the above program is not good.
DeleteRSVP.
really good ans
ReplyDeleteA program to check whether the sum of factors is even or odd
ReplyDeleteI have not get the output properly
ReplyDeleteThe logic or program both are easy. And it is easy to understand.
ReplyDelete