can any one help in this program?
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void){
srand(time(NULL));
int r = rand();
int op = 0;
while(0==0){
printf("Enter a value\n ");
scanf("%i\n",&op);
if (op == r ){
printf("yes");
break;
}
else if( op<r)
printf("Your guess is lower than the number");
else
printf("Your guess is higher than the number");
}
printf("%i",r);
return 0;
}
when i try the program in "terminal" the result is always : Your guess is lower than the number
i don't know what's going on? but when i use code blocks in windows it seems perfect.
is this problem from Linux or the compiler
i wrote cc main.c in terminal then " ./a.out"