Hey guys, im trying to make this lottery game work.. I know that the line that says 10+rand()%90 is incorrect. What can i do to make it better. You dont have to give me the answer if you dont want to. just point me in the right direction please. ive been working on it for a few hours and its frustrating me.. am i even using the rand number correectly? please and thank you. please help.. thank you.. Code: #include <stdio.h> #include <stdlib.h> 10+rand()%90 int main() { input-input%10)/10 if(input==random number) { printf("You have won $10000\n"); break; } else { if (input%10==random number || ((input-input%10)/10)==random number) { printf("You have won $1000\n"); break; } printf("You have won nothing\n"); } return 0; }
see the code below Code: #include <stdio.h> #include <stdlib.h> #include <time.h> int main(){ srand(time(NULL)); int number=10+rand()%90; printf("\n hint=%d",number); int input=0; printf("\nguess a number:"); scanf("%d",&input);getchar(); if(input==number){ printf("You have won $10000\n"); } else if (input%10==number || ((input-input%10)/10)==number){ printf("You have won $1000\n"); }else printf("You have won nothing\n"); getchar(); return 0; }