+ 1
How to use >= in comparing with 0? Is this code is right? Please answer
#include<stdio.h> int main() { int a; scanf("%d ", &a); if( a >= 0) printf("Ok"); else printf("Not ok"); return 0; }
1 Answer
+ 3
what do you mean by "this code is right?"?
Your code prints "Ok" for integers greater or equal to 0 and "Not ok" for integers less than 0 (negatives).
if this is what you want then it's right.