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 / pankaj khaitan

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 ?    40 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between goto, long jmp() and setjmp()?

1121


simple program of graphics and their output display

1936


How will you write a code for accessing the length of an array without assigning it to another variable?

999


A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

1043


Why is c fast?

1007


What does c mean?

972


in linking some of os executables are linking name some of them

2074


Explain the difference between malloc() and calloc() in c?

1004


What does nil mean in c?

1180


‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .

2838


What is a scope resolution operator in c?

1203


Find duplicates in a file containing 6 digit number (like uid) in O (n) time.

3182


Is c procedural or object oriented?

952


#include #include struct stu { int i; char j; }; union uni { int i; char j; }; void main() { int j,k; clrscr(); struct stu s; j=sizeof(s); printf("%d",j); union uni u; k=sizeof(u); printf("%d",k); getch(); } what is value of j and k.

6187


Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.

1053