Doctor's Secret

Cheeku is ill. He goes to Homeopathic Doctor - Dr. Thind. 

Doctor always recommends medicines after reading from a secret book that he has. This secret book has recipe to cure any disease. Cheeku is chalak. He wants to know if Doctor is giving him the correct medicine or not. 

So he asks Doctor 2 questions -

  1. Length of the name of the Book.
  2. The number of pages in the Book.

Cheeku will take medicine from him only if Length of name of Book is lesser than or equal to 23 and number of pages in book is between 500 to 1000.

Otherwise he will not take medicine from this Doctor.

Help Cheeku decide. Print "Take Medicine" if he should take medicine from doctor. Else print "Don't take Medicine".

Example:

Input:  n = 10, m = 600
Output: Take Medicine

Approach

C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n = 10m = 600;

    if (n <= 23 && m >= 500 && m <= 1000)
        cout << "Take Medicine\n";
    else
        cout << "Don't take Medicine\n";
    return 0;
}


No comments:

Post a Comment