CrazyEngineers
  • ravibharadwaj
    ravibharadwaj

    MemberNov 9, 2006

    'C' code

    int g=300*300/300;
    cout<<"g="<
    what would be the value of g? If you think the answer is you got is correct
    Justify your answer.
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Rocker

    MemberNov 9, 2006

    ravibharadwaj
    int g=300*300/300;
    cout<<"g="<<g;

    what would be the value of g? If you think the answer is you got is correct
    Justify your answer.
    I'm not a C coder, but g = 109.223 😉

    Right?

    Justification, 300*300 exceeds max. integer range which is -32768 to 32767
    Are you sure? This action cannot be undone.
    Cancel
  • amitpshukla

    MemberNov 9, 2006

    radio designing

    i want to design a low power radio circuit, please give some ideas.
    Are you sure? This action cannot be undone.
    Cancel
  • sahana

    MemberNov 10, 2006

    the answer will be 81.
    300*300/300

    first 300*300 will be computed which is 90000.this is greater than 32767 which is the limit of data type int.hence 90000%32767 will be calculated which is 24466.now this will be divided with 300 (as the expression is 300*300/300). hence the answer is 81.
    Are you sure? This action cannot be undone.
    Cancel
  • crook

    MemberNov 10, 2006

    sahana
    the answer will be 81.
    300*300/300

    first 300*300 will be computed which is 90000.this is greater than 32767 which is the limit of data type int.hence 90000%32767 will be calculated which is 24466.now this will be divided with 300 (as the expression is 300*300/300). hence the answer is 81.
    Sahan's explanation is better. I think the answer is 81. ravibharadwaj please post the correct answer.
    Are you sure? This action cannot be undone.
    Cancel
  • ravibharadwaj

    MemberNov 12, 2006

    Good one sahana and crook. Keep up the good work.
    post in more puzzels
    Are you sure? This action cannot be undone.
    Cancel
  • rick

    MemberNov 12, 2006

    ravibharadwaj
    Good one sahana and crook. Keep up the good work.
    post in more puzzels
    Is that the right answer though? Please confirm. I think 81 is the right answer.
    Are you sure? This action cannot be undone.
    Cancel
  • ravibharadwaj

    MemberNov 18, 2006

    Yup 81 is the right answer. Plz do post some c or c++ puzzles
    Are you sure? This action cannot be undone.
    Cancel
  • Munguti

    MemberSep 30, 2010

    Re: radio designing

    I think you should start a new thread with a heading RADIO DESIGNING. Is it an AM or FM reciever
    Are you sure? This action cannot be undone.
    Cancel
  • naveeen reddy polimera

    MemberDec 26, 2015

    according to the BODMAS rule division '/' will execute and then * will execute

    300*300/300=300*(300/300)
    Are you sure? This action cannot be undone.
    Cancel
  • simplycoder

    MemberJan 4, 2016

    It can be 300 aswel, did anyone verify it?
    If yes, please share the os and which compiler and also the bit version of the compiler.
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register