Friday, 20 December 2013

/*TO FIND THE SUM OF ENTERED NUMBER USING FUNCTIONS*/


OUTPUT





INPUT

#include<conio.h>
#include<stdio.h>
void sumof()
{
int num,temp,r,sum=0;
printf("Enter a number");
scanf("%d",&num);
temp=num;
while(temp>0)
{
r=temp%10;
sum=sum+r;
temp=temp/10;
}
printf("The sum of entered number is %d",sum);
}
void main()
{
sumof();
}



No comments:

Post a Comment