Page 2 of 2 FirstFirst 12
Results 21 to 29 of 29

Thread: What is a output?. How will Come?.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Oct 2007
    Answers
    1

    Re: What is a output?. How will Come?.

    the o/p of this program is 00131
    in given expression (m=i++&&j++&&k++||l++) operater play an imp role
    i.e. we will first evaluted incre. op. that has higher predency after that we will evaluted logical AND op(&&) and after that logical OR(||) op.and at the end as.op(=) will be evaluted . note that it is a logical exp. so m have value either 1 or 0. while in this exp it is true so has 1 as o/p
    and the value of i,j,k and l is incremented when write exp , so it print these incremented value by 1 so these value become 0,0,1,and 3 and the value of m is evaluted in exp ,1
    dilip agrawal mca indore mp


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

    Re: What is a output?. How will Come?.

    00131 is the answer.
    m=i++ && j++ && k++ || l++;
    let us leave all the postfix increments because they will change the values only in the next statement of their respective variables. so m=i && j&& k|| l
    -1 && -1=0
    0 && 0=0
    0 || 2=1
    so m is 1. this statement is over then all the variables will be incremented by 1 because of that postfix increments. so output is 00131


  3. #3
    Junior Member
    Join Date
    Nov 2007
    Answers
    1

    Re: What is a output?. How will Come?.

    out put vil b
    -1,-1,0,2,1


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

    Smile Re: What is a output?. How will Come?.

    Quote Originally Posted by Golda View Post
    main()
    {
    int i=-1,j=-1,k=0,l=2,m;
    m=i++&&j++&&k++||l++;
    printf("%d %d %d %d %d",i,j,k,l,m);
    }
    i=0,j=0,k=1,l=3,m=0


  5. #5

    Re: What is a output?. How will Come?.

    0 0 1 2 -1


  6. #6
    Junior Member
    Join Date
    Jan 2007
    Answers
    7

    Re: What is a output?. How will Come?.

    0,0,1,3,0
    is this correct


  7. #7
    Junior Member
    Join Date
    Jul 2009
    Answers
    5

    Re: What is a output?. How will Come?.

    the output will be 00131
    All the effect will be occur at next statement because of post increment
    the || operator is the last element and the value of l is 2 so that any value of the previous generation will be ommited and the value of m will be true i.e. 1
    m=0||1 is 1
    i=-1 --> 0
    j=-1 --> 0
    k=0 --> 1
    l=2 --> 3
    m = 1


  8. #8
    Junior Member
    Join Date
    Sep 2009
    Answers
    1

    Re: What is a output?. How will Come?.

    Quote Originally Posted by Golda View Post
    main()
    {
    int i=-1,j=-1,k=0,l=2,m;
    m=i++&&j++&&k++||l++;
    printf("%d %d %d %d %d",i,j,k,l,m);
    }
    Output : 0 0 1 3 1
    EXP : As the expression have 3 && operators at the begin it will check for all the case s ,& will get 0 as resultant wch is || with 1 (i.e.,2) So that m=0||1=1.


  9. #9
    Junior Member
    Join Date
    May 2009
    Answers
    1

    Re: What is a output?. How will Come?.

    i=0,j=0,k=1,l=3,m=0


Page 2 of 2 FirstFirst 12

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