ok I'm vedry new to C. I know if you want to use an interger vairiable you put scanf("%d", X) then you put if X = 2 then do this.
how do you put if X = + or X = -?
what are the mathmatical sybols? do they fall in the character category or what?
ok I'm vedry new to C. I know if you want to use an interger vairiable you put scanf("%d", X) then you put if X = 2 then do this.
how do you put if X = + or X = -?
what are the mathmatical sybols? do they fall in the character category or what?
First, it should be:
scanf("%d", &X);
Then to test if it's positive or negative, just use the less/greater than symbols.
You could also use if else statements if you preferred.Code:if( X < 0 ) { /* X is negative */ } if( X > 0 ) { /* X is positive */ } if( X == 0 ) { /* X is zero */ }