Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
923 B
1
Indexable
Never
#include <stdio.h>

int main(){
	int cow;
	int chicken;
	int cowfeet;
	int chickenfeet;

	printf("\n How many cows are there on the farm? ");
	scanf("%d", &cow);
	
	printf("\n How many chicken are there on the farm? ");
	scanf("%d", &chicken);
	
	if(cow>=1 && chicken >=1){
		cowfeet = cow * 4;
		chickenfeet = chicken * 2;
	
		printf("\n Total number of feet on the farm is %d ", cowfeet + chickenfeet);

	}
	else if(cow == 0 && chicken >=1){
		printf("\n There are no cows on the farm. ");
		chickenfeet = chicken * 2;
		
		printf("\n Total number of feet on the farm is %d", chickenfeet );
	}
	else if(cow >= 1 && chicken == 0){
		printf("\n There are no chicken on the farm. ");
		cowfeet = cow * 4;
		
		printf("\n Total number of feet on the farm is %d", cowfeet );

	}
	else if(cow == 0 && chicken == 0){
		printf("\n There are no cows and chicken on the farm");
	}
	return 0;
}