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 / d. prashant

#include<stdio.h>
#include<conio.h>
main()
{
int n,i,sum=0,r;
printf("enter the value");
scanf("%d",&n);
while(n)
{
rem=num%10;
sum=sum+rem;
num=num/10;
}
printf("sum = %d",sum);
}

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is spaghetti programming?

1072


What is dynamic variable in c?

986


What is the purpose of void in c?

992


What is bin sh c?

987


What is an auto keyword in c?

1045


What is indirection? How many levels of pointers can you have?

1090


Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

2136


application attempts to perform an operation?

1917


What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?

1271


What language is windows 1.0 written?

989


What is the best style for code layout in c?

1048


What is the difference between union and anonymous union?

1249


Explain #pragma statements.

979


can we implement multi-threads in c.

1087


a value that does not change during program execution a) variabe b) argument c) parameter d) none

1181