Explain the logic
k=num%10;
sum=sum+k;
num=num/10;
Answers were Sorted based on User's Feedback
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 |
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 |
'X' liters of petrol can be filled in an automobiles tank. What part of full tank was removed, if 'Y' liters was removed when the tank was full?
Two planes take off at the same exact moment. They are flying across the Atlantic Ocean. One leaves New York and is flying to Paris at 800 km/hr. The other leaves Paris and is flying to New York at only 750 km/hr ( because of a strong head wind ). Which one will be closer to Paris when they meet?
3 Answers Wipro, Zarca Interactive,
what is the number whose reminder is 2 after dividing 5and also reminder is 4 after deviding 7 and reminder is 6 after deviding 9?
If a sum of money compound annually amounts of thrice itself in 3 years. In how many years will it become 9 times itself?
Initially two cups of same volume are present with milk filled upto 3/5th and 4/5th of their volumes.Water is then filled. Then two mixtures are mixed. Find the ratio of water to milk in the mixture.
for cube and sphere 3 views are similarly draw one such figure?
There are 6 people W,H,M,C,G,F who are murderer , victim , judge , police, witness, hangman. There was no eye witness only circumtancial witness. The murderer was sentenced to death. Read following statement and determine who is who. 1. M knew both murderer and victim. 2. Judge asked C to discribe murder incident. 3. W was last to see F alive. 4. Police found G at the murder site. 5. H and W never met.
Classic: If a bear walks one mile south, turns left and walks one mile to the east and then turns left again and walks one mile north and arrives at its original position, what is the color of the bear.
9 Answers EXL, Microsoft, TCS,
The largest rubber producer in the world__________
A,B,C,D,E are some numbers.if AB * CD = EEE and CD - A =CC THEN what is AB * D =? IN SAME CODE .
Mr. Wagle goes to work by a bus. One day he falls asleep when the bus still has twice as far to go as it has already gone. Halfway through the trip he walks up as the bus bounces over some bad potholes. When he finally falls asleep again, the bus still has half the distance to go that it has already traveled. Fortunately, Mr. Wagle wakes up at the end of his trip. What portion of the total trip did Mr. Wagle sleep? a) 50% b) 25% c) 30% d) 75%
Mr. T has a wrong weighing pan. One arm is lengthier than other. 1 kilogram on left balances 8 melons on right, 1 kilogram on right balances 2 melons on left. If all melons are equal in weight, what is the weight of a single melon?