Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int main(void)
- {
- int yourNumber;
- int count = 0;
- srand(time(NULL));
- int r = (random() % 20) + 1;
- int subsc = abs(yourNumber - r); // farkı buldum.
- while(yourNumber != r){
- printf("Sayini gir : ");
- scanf("%d",&yourNumber);
- if(subsc == 4) // fark 4 ise ... desin
- printf("Çok yaklaştın...");
- count = count + 1;
- if(yourNumber == r)
- printf("%d kerede bulundu.\n",count);
- printf("%d\n",r); // bulamiyorum diye sayinin kaç olduğunada bakayım dedim
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement