Computer Science, asked by shanmugam2645, 10 months ago

Dora is very much interested in gardening and she decides to plant more trees in her garden. She plants trees in the order of rows and columns. She numbered the trees in column wise order. She planted the mango trees only in the second column from both first and last. But later when the trees grew up, she forgot where she planted mango trees. So help her find out whether the given tree number is a number of mango trees or not. Display whether "It is a mango tree" or "It is not a mango tree".

Answers

Answered by noushin99882
44

Answer:

#include<iostream>

using namespace std;

int main()

{

int a,b,c,r;

 cin>>a>>b>>c;

 r=c%3;

 //cout<<r;

 if(r!=0 ){cout<<"It is a mango tree";}

 else{cout<<"It is not a mango tree";}

}

Explanation:

Answered by rajalakshmir2017cse
5

Answer:#include<iostream>

using namespace std;

int main()

{

 int r,c,t;

 cin>>r>>c>>t;

 if((t>=r && t<=(2*r))||(t<=(r*(r-1)) &&t>=(r*(r-2))))

    cout<<"It is a mango tree";

    else

    cout<<"It is not a mango tree";

     

 

}

Explanation:

Similar questions