Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <locale.h>
- int main(void) {
- int min = 1;
- int max = 1000;
- int number;
- char answer;
- setlocale(LC_ALL, "Russian");
- printf("Пожалуйста, используйте следующие разрешенные символы: ( + / — / = )\n\n");
- while(1) {
- number = (min + max) / 2;
- printf("Загаданное Вами число? %d\n", number);
- scanf("%c", &answer);
- if (answer == '+') { // больше
- min = number;
- }
- if (answer == '-') { // меньше
- max = number;
- }
- if (answer == '=') { // угадали))00)
- break;
- }
- }
- printf("Вы загадали число: %d\n", number);
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement