Results 1 to 9 of 9

Thread: what will be the output?

  1. #1
    Junior Member
    Join Date
    Jul 2007
    Answers
    15

    Question what will be the output?

    x=5
    y=++x * ++x

    what will be the value of y?


  2. #2
    Junior Member
    Join Date
    Oct 2007
    Answers
    28

    Re: what will be the output?

    49 , but i can't understand the logic pls tell


  3. #3
    Contributing Member
    Join Date
    Mar 2007
    Answers
    34

    Re: what will be the output?

    43
    scanning from left
    5+1=6*6+1=7=42+1
    43


  4. #4
    Junior Member
    Join Date
    Oct 2007
    Answers
    28

    Re: what will be the output?

    hello, rohit
    when i run this code the result is 49 not 43?


  5. #5
    Junior Member
    Join Date
    Oct 2007
    Answers
    1

    Re: what will be the output?

    i am not sure how the compiler works , 43 or 49. please tell sir

    Last edited by kareem; 10-29-2007 at 04:43 AM. Reason: want to know more

  6. #6
    Junior Member
    Join Date
    Oct 2007
    Answers
    3

    Re: what will be the output?

    Quote Originally Posted by mahesh9920 View Post
    x=5
    y=++x * ++x

    what will be the value of y?
    the o/p of code is
    42


  7. #7
    Contributing Member
    Join Date
    Oct 2007
    Answers
    88

    Smile Re: what will be the output?

    Quote Originally Posted by mahesh9920 View Post
    x=5
    y=++x * ++x

    what will be the value of y?
    the value is assigined only in left side

    a=5;
    b= 7*7;
    b=49
    b=++a*++a;
    *(7);
    (7)
    b=7*7;
    b=49;


  8. #8

    Re: what will be the output?

    hi!! answer will be 49.bcz firstly++ poerates than *


  9. #9

    Re: what will be the output?

    Quote Originally Posted by amar1_001 View Post
    49 , but i can't understand the logic pls tell
    hi amar. answer is 49 bcz firstly ++ operates two times so x becomes 7 and then 7*7=49


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact