Project predictor
In the three-field system the sequence of field use involved an autumn planting of grain (wheat, barley or rye) and a spring planting of peas, beans, oats or barley. The third was left fallow, in order to allow the soil of that field to regain its nutrientsThe 3 durations(4 months each) are,
Duration 1: 1-4 (all inclusive)
Duration 2: 5-8 (all inclusive)
Duration 3: 9-12 (all inclusive)
The 2 crops that were used are,
Crop 1: Winter Wheat
Crop 2: Beans
The initial crops in three fields at month 1are,
Field 1: Winter Wheat
Field 2: Beans
Field 3: Left Fallow
Given the month number and field number, write a program to print the crop name.
Input Format:
The first input is an integer corresponds to month number.
The second input is an integer corresponds to field number.
Output Format:
The output is the string.
Sample Input 1:
5
2
Sample Output 1:
Winter Wheat
Sample Input 2:
2
3
Sample Output 2:
Left Fallow
Sample Input 3:
2
2
Sample Output 3:
Beans
//Program
#include<stdio.h>
int main()
{
int mn,fn;
scanf("%d",&mn);
scanf("%d",&fn);
if(mn<=4)
{
if(fn==1)
{
printf("Winter Wheat");
}
if(fn==2)
{
printf("Beans");
}
if(fn==3)
{
printf("Left Fallow");
}
}
else if((mn>4)&&(mn<=8))
{
if(fn==1)
{
printf("Left Fallow");
}
if(fn==2)
{
printf("Winter Wheat");
}
if(fn==3)
{
printf("Beans");
}
}
if(mn>8)
{
if(fn==1)
{
printf("Beans");
}
if(fn==2)
{
printf("Left Fallow");
}
if(fn==3)
{
printf("Winter Wheat");
}
}
return 0;
}
Comments
Post a Comment