14

My teacher tell me to do this..
So dumb right ?

Comments
  • 1
    what dumb
  • 1
    It really depends on the variable. If it's a float or a signed integer then it's by all means the right way
  • 0
    So 0 is greater than 1?
  • 1
    Depends if you want to do something when variable1 is just not 0 i.e after the second if
  • 0
    for that particular case it makes no sense, but if that var is nullable then checking if not null then doing some code.

    Or in this case where its an integer, maybe a block of code to be executed regardless of value we have and which "if" gets executed.

    Again, without more info that as is, is not reasonable to write
  • 3
    Ask for a "why". What might seem strange might have a perfectly reasonable explanation.
  • 0
    I don't get all the teacher bashing you find on here. Most teachers are not stupid. It's often just a miscommunication or something the student is wrong about.
  • 0
    Redundant code.
  • 0
    @jOkEr-jAsE Of course but their was nothing inside the if with ! = 0
    I did the same program only using > 1...
  • 0
    For all that are telling that i'm wrong, well the teacher didn't used the condition with != 0 but only > 1

    void Binary(int decimal) {
    int val1 = decimal/2;
    int val2 = decimal%2;

    if (val1 != 0) {
    if (val1 > 1) {
    Binary(val1);
    }
    }
    printf("%d", val2);
    }

    Sorry but this is stupid.
  • 0
    @kamen The teacher doesn't understand me about this and i do not undestand why he does this
  • 0
    @jOkEr-jAsE Yea maybe that's why.
    You are right
Add Comment