write a program for input is 56 output will be 5+6=10?

Answer Posted / saranya

#include<stdio.h>
#include<conio.h>
main()
{
int n,a,b=0;
clrscr();
printf("Enter the n value");
scanf("%d",&n);
while(n!=0)
{
a=n%10;
b=b+a;
n=n/10;
}
printf("Result is %d",b);
getch();
}

Is This Answer Correct ?    2 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

why multiple inheritence concept is not supported in c#?

1554


what are basic step involved in embedded system software development?

2600


10. Write a program in ā€˜Cā€™ language that will perform the following operation on double link list. Each node of this list contains the address of previous as well as next node. The previous pointer of first node & next pointer of last node should contain null. 1. Creation of list with as many records as user want 2. Search a node in the list 3. Deletion at last position 4. Display 5. Exit Create separate functions for each operation. The create () will be used to create the list. It should accept no argument & return the address of the starting node. Search() will search a node in the list. It receives rollno as argument & return that node if found otherwise return null. The delete () function will delete the last node. It does not receive any argument & return structure type value at last position. The starting node of the double list must be declared as external pointer variable. Each element of double link list will contain the following information Roll No, Std Name, Course. Use do-while loop & switch case for generating the above menu. The format of the output should is given below: S.No. Roll No. Student Name Course 1 cse01 Anil Singh B.Tech

1481


If any kind of accident happen without any information to any one .what kind of action we have to take

1379


how am i supposed to convert a class program in C++ to Matlab? Do i also need to make classes in matlab too or I can do it without making classes???Can somebody help....

1336






Define function ? Explain arguments in functions ?

1540


can you provide me uniken pvt ltd. technical interview question and answer?

2624


What is the pressure in co2 cartridge in a DCP 5 kg extinguisher.

2834


hello sir,pls fdorward previous group-I exam papers .....

1529


wht is difference b/ osi & tcp/ip model

1553


how to increase the chiller effiency?

1557


Please tell us about an implementation that you worked on that did not go as planned. What were the challenges you faced and how did you overcome them

1552


What is the difference between operator overloading and function overloading in C when compared with C++?

1322


What are annotations? What are assertions? why they are used why not if-else?? what is normalization? what is QuickSort? what are Avl trees?

1838


how many clusters are generated by k-means algorithm?

1069