write a program to sum of its digit with using control
structure or with out using loop. for ex: let the number is
25634 then answer will be=2+5+6+3+4=20
Answer Posted / thiruapthi rao
// mainlogic
while(number>0)
{
remainder=number%10;
sum=sum+remainder;
number=number/10;
}
/*
number=123
sum=1+2+3=6
*/
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is sizeof int?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
What is a union?
What's the difference between constant char *p and char * constant p?
The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration
Define Array of pointers.
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.
Explain what does the format %10.2 mean when included in a printf statement?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
List the difference between a 'copy constructor' and a 'assignment operator' in C?
Is main is a keyword in c?
Write a program to check armstrong number in c?
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
What is volatile, register definition in C
Process by which one bit pattern in to another by bit wise operation is?