Computer Science, asked by bishtvarsha8694, 7 months ago

Dora is interested so much in gardening and she plants more trees in her garden. She plants trees in a rectangular fashion with the order of rows and columns and numbered the trees in row-wise order. She planted the mango tree only in a 1st row, 1st column and last column. So given the tree number, your task is to find whether the given tree is a mango tree or not? Write a program to check whether the given number is a mango tree or not.

Answers

Answered by abhisahugm007
0

Answer:

#include<iostream>

using namespace std;

int main()

{

int a,b,n,flag=0;

 cin>>a>>b>>n;

for(int i=1;i<a;i++)

{

 if(n==i*b+1)\

   {

     flag=1;

     break;

   }

}

   if(n<=b || flag==1)

   cout<<"Yes";

 else

   cout<<"No";

}

Explanation:

Similar questions