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

How many ewes (female sheep) in a flock of 50 sheep are black? 1. There are 10 rams (male sheep) in the flock. 2. Forty percent of the animals are black. statement 1 alone is sufficient, but statement 2 alone is not sufficient to answer the question statement 2 alone is sufficient, but statement 1 alone is not sufficient to answer the question each statement alone is sufficient statements 1 and 2 together are not sufficient, and additional data is needed to answer the question

3564


If all the natural numbers from 256 to 400 are written side by side to each other, a large natural number is obtained. How many times 6 appears in this large natural number?

703


A person travels 12 km in the southward direction and then travels 5km to the right and then travels 15km toward the right and finally travels 5km towards the east, how far is he from his starting place?

760


A is driving on a highway when the police fines him for over speeding and exceeding the limit by 10 km/hr.same time B is fined for over speeding by twice the amount by which A exceeded the limit.If he was driving at km/hr what is the speed limit for the road?

1217


Lucia is a wonderful grandmother and her age is between 50 and 70. Each of her sons have as many sons as they have brothers. Their combined ages give Lucia's present age.what is the age?

903






Ramesh working alone on a job takes 12 days more than what he would have taken if Suresh had worked along with him while Suresh working alone on the same job takes 27 days more than what he would have taken if Ramesh had worked along with him. Find the time that both of them would take together to do the job.

753


Y catches 5 times more fishes than X. If total number of fishes caught by X and Y is 48, then number of fishes caught by X?

802


Fill the empty slots. Three FOOTBALL teams are there. Given below the list of maches. played won lost draw Goals for Goals against A 2 2 *0 *0 *7 1 B 2 *0 *1 1 2 4 C 2 *0 *1 *1 3 7 the slots with stars are answers.

774


im swetha... is the chances 4 science graduates are less when compared with arts & commerce graduates 4 a bank job? why im asking bcoz, i attended for four banks interview like sbi[2], bank of baroda, karur vysya bank after selected in the written test. i attended interview very well. but not.. why this?

1657


Aeroplane is flying at a particular angle and latitude,after some time another latitude is given..(8 hrs later), You are asked to find the local time of the place.

673


Find the next letter in the series Q,W,E,R,T,--

708


ram singh goes to his office in the city, every day from his suburbun house. his driver mangaram drops him at the railway station in the morning and picks him up in the evening. Every evening ram singh reaches the station at 5 o'clock. mangaram also reaches at the same time. one day ramsingh started early from his office and came to the station at 4 o'clock. not wanting to wait for the car he starts walking home. Mangaram starts at normal time, picks him up on the way and takes him back house, half an hour early. how much time did ram singh walk.

1015


Rakesh buys 1 gallon of milk for Rs.12 and mixes it with 20% water. He then sells it for Rs.15, What is the percentage of gain that Rakesh would get.

731


A man said to woman " your only brother's son is my wife'sbrother". How is the woman related to the man's wife..

1019


If A=Z, B=Y, C=X, .......... Z=A, Then ZERD = ?

772