madhusudhan b

madhusudhan b

  • NA
  • 1
  • 648

solution for question

Sep 9 2015 10:10 AM

1)if the result is not 0, double the result and use it as the first number and repeat step 1.

For example :

let us consider 7 , 8 as inputs
step 1 :
7 * 2 - 8 = 6, which is not zero, so it goes to next step and first number is 6
6 * 2 - 8 = 4, which is not zero, so it goes to next step and first number is 4
4 * 2 - 8 = 0, here it satisfies the condition so system will print 7 , 8

Another sample set that satisfies the above condition: 10, 20
10 * 2 - 20 = 0, here it satisfies the condition so system will print 10 , 20

2)lmplement a function by reading one string from keyboard
And that string must have for every opening parenthesis it must be close with corresponding parenthesis.
Example 1:((hai hello ) all the (best))
It should return true.
Example 2: ())(
It should return false.

Answers (2)