Explain the logic
k=num%10;
sum=sum+k;
num=num/10;

Answer Posted / rudrapathi

It is the logic for adding the digits of given number

for example no is 1234

output is 1+2+3+4=10

Is This Answer Correct ?    27 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Complete the series 1 6 3 7 5 8 7 ?

746


500 men are arranged in an array of 10 rows and 50 columns . ALL tallest among each row are asked to fall out . And the shortest among THEM is A. Similarly after resuming that to their original positions that the shortest among each column are asked to fall out. And the longest among them is B . Now who is taller among A and B ?

832


Find the next number in the series 1,2,5,10,,15,22--

712


The cycle has following specifications: The rear derailer is on the 14 tooth gear and the front derailer is on the 52 tooth gear. The rear gear has 14 teeth. The diameter of the rear wheel is 27". If a cyclist pedals at 75 revolutions per minute, then what will be the speed achieved?

717


A can do a piece of work in 20 days, which B can do in 12 days. In 9 days B does ¾ of the work. How many days will A take to finish the remaining work?

688






600 tennis players 4% ->wrist band on one wrist of remain 96%->25%->on both hands remain no of ---

740


I most like to work with? Most men act though?

1417


A boy picks up the phone and asks" who are you?" The voice from the other side answers" I am your mother's mother in law".What is the relation of the boy with the fellow speaking at the other end.

816


There six red shoes & 4 green shoes .If two of the shoes are drawn.What is the probability of getting two red shoes.

785


if x/y =4 and y is not '0' what % of 'x' is '2x-y'

730


There are 4 numbers as 5,8,2,1 Form 4, four digit numbers as A, B and find the sum?

774


One of the longest sides of the triangle is 20 m. The other side is 10 m. Area of the triangle is 80 m2. What is the another side of the triangle?

766


a train covers the distance D between two cities in hours arriving 2 hours late.what rate would permit to train to arrive on schedule?

871


In a class composed of x girls and y boys what part of the class is composed of girls

801


in space ship 5men are going1.doctor,drug asdditive 2.lady lawer has done crime 3.teacher emotinally imbalanced 4. 18 year old aeruonautical engineer 5. noble lauraut .suddenly some thing happend and oxygen is available to only three people to use which of three you choose

759