Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to find sum of digits in C?

Answer Posted / pooja

main()
{
int n,i,sum=0,r;
printf("enter the value");
scanf("%d",&n);
while(n!=0)
{
r=n%10;
n=n/10;
sum=sum+r;
}
printf("\nsum of digits is %d",sum);
}

Is This Answer Correct ?    57 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what are global variables and explain how do you declare them?

1175


What is data structure in c language?

1117


What is variable declaration and definition in c?

902


What does volatile do?

988


.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }

2592


What is a header file?

1088


Is a pointer a kind of array?

1193


Under what circumstances does a name clash occur?

1213


How do I determine whether a character is numeric, alphabetic, and so on?

1140


What is fflush() function?

1141


How can I discover how many arguments a function was actually called with?

1072


How can I send mail from within a c program?

1037


Describe the steps to insert data into a singly linked list.

1077


Explain what does it mean when a pointer is used in an if statement?

1072


What's the best way of making my program efficient?

1110