Program to find the sum of digits of a given number until
the sum becomes a single digit
Answer Posted / sohini khan
main()
{int n,p,s=0;
while(n>0)
{
p=n%10;
s=s+p;
n=n/10;
}
printf("%d",s);
getch(),
}
Is This Answer Correct ? | 29 Yes | 43 No |
Post New Answer View All Answers
What is c mainly used for?
When is the “void” keyword used in a function?
What is the difference between int main and void main?
How do you determine whether to use a stream function or a low-level function?
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
Is register a keyword in c?
What is derived datatype in c?
Linked lists -- can you tell me how to check whether a linked list is circular?
What is a shell structure examples?
What are the benefits of c language?
What are the types of functions in c?
i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical
What is merge sort in c?
What are the functions to open and close the file in c language?
Sir,please help me out with the code of this question. Write an interactive C program that will encode or decode multiple lines of text. Store the encoded text within a data file, so that it can be retrieved and decoded at any time. The program should include the following features: (a) Enter text from the keyboard, encode the text and store the encoded text in a data file. (b) Retrieve the encoded text and display it in its encoded form. (c) Retrieve the encoded text, decode it and then display the decoded text. (d) End the computation. Test the program using several lines of text of your choice.