logo

CuriousTab

CuriousTab

Discussion


Home Interview Technology Comments

  • Question
  • How to identify a given positive decimal number as even/odd without using % or / operator ?


  • Correct Answer
  • You may be very good at coding,but if you questioning how on earth you could solve this problemThen here is a solution If you remember the good old days of our primary school then the solution is easy,"division is a matter of iterative subtraction" public class TestEvenOdd { public static void main(String arg[ ]){ int num=6; int result=num; while(result>=2){ result=result-2; } if(result==1){ Systemoutprintln("The number is odd"); }else{ Systemoutprint("The number is even"); } } } 


  • Technology problems


    Search Results


    • 1. Which containers use a FlowLayout as their default layout ?
    • Discuss
    • 2. What is WATER MARK in oracle? Explain the significance of High water mark.
    • Discuss
    • 3. What?s the difference between htmlentities() and htmlspecialchars()?
    • Discuss
    • 4. Record set types and Number available in VB?
    • Discuss
    • 5. How do you define a traceability matrix?
    • Discuss
    • 6. Difference between Arraylist and Linked list?
    • Discuss
    • 7. What is Spring IoC container ?
    • Discuss
    • 8. How can you avoid callback hells ?
    • Discuss
    • 9. What is the difference between ViewState and SessionState?
    • Discuss
    • 10. What is immutable object? Can you write immutable object ?
    • Discuss


    Comments

    There are no comments.

Enter a new Comment