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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / bariki shanmukha[anantapuram,m

I wil take 3 variables such as,sum=0,k,num[IT REPRESENTS
GIVEN NUMBER BY THE USER].

itr1 itr2 itr3 itr4 itr5

k : - 4 3 2 1

sum: 0 4 7 9 10

num: 1234 123 12 1 0

like that exucution wil b starts which is above mentioned.

Is This Answer Correct ?    11 Yes 3 No

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

Answer / cathie

reverse of a number

Is This Answer Correct ?    3 Yes 7 No

Post New Answer

More General Aptitude Interview Questions

A machine puts c caps on bottles in m minutes. How many hours will it take to put caps on b bottles?

3 Answers  


If + means * and * means / and / means %. what is the value of 2+3*5/7?

26 Answers   Accenture,


2 12 30 56............. series?

9 Answers   Royal Mail,


A team of 200 wagers undertakes building work of a bridge. The total time allocated to build the entire bridge is 20 days. After 10 days since start, 200 more wagers join the team and together the team completes the bridge in required time. If the original team do not get those 200 extra wagers, how many days they would be behind schedule to complete building the bridge.

0 Answers   Wipro,


Let's say that you have 25 horses, and you want to pick the fastest 3 horses out of those 25. In each race, only 5 horses can run at the same time because there are only 5 tracks. What is the minimum number of races required to find the 3 fastest horses without using a stopwatch?

0 Answers   TCS,






Write a C Program to declare an array for 2 0 floats. Accept the values from the user sort the two arrays in descending order. Merge the two arrays into a new array and display the new array.

0 Answers  


who said that " Divide and rule "

4 Answers   TCS,


The first United States Solicitor General, Benjamin H. Bristow, __________________________ was born in 1832 and served in the Grant administration from 1874 to 1876. Earlier in his life, Bristow served as a lieutenant colonel in the 25th Kentucky Infantry was born in 1832 and had served in the Grant administration from 1874 to 1876. Earlier in his life, Bristow served as a lieutenant colonel born in 1832 and served in the Grant administration from 1874 to 1876. Earlier in his life, Bristow had served as a lieutenant colonel in the 25th Kentucky Infantry born in 1832 and appointee in the Grant administration from 1874 to 1875. Earlier in his life, Bristow served as a lieutenant colonel in the 25th Kentucky Infantry

0 Answers  


Find the next series: AC CG GO OE ?

0 Answers   CTS,


The average of 13 papers is 40. The average of the first 7 papers is 42 and of the last seven papers is 35. Find the marks obtained in the 7th paper?

0 Answers   Axis Bank,


three friends a,b,c run around a circular track of length 120m at a speed of 5,7,15m/sec respectively starting simultaneously from the same point in the same direction .how often they three will meet????

5 Answers  


A school has 30% students from Maharashtra .Out of these 20% are Bombey students. Find the total percentage of Bombay?

0 Answers   3i Infotech, Canara Bank, Geodesic,


Categories