+ 4
If there are m heads and n feet. How to write program to display no of cows and no of men found?
Sample input 1: 3 10 Sample output 1: Cows :2 Men :1 Sample input 2: 10 44 Sample output 2: Invalid input
3 Respostas
+ 7
Cow=(n-2*m)/2;
Men=m-(n-2*m)/2;
After solving
+ 2
Hi Roshini
I don't normally like to post a complete answer, but if you wish, there is an option here.
https://code.sololearn.com/c2qtBl37cpV7/?ref=app
0
a=int(input())
b=int(input())
c=a
d=0
if (b>(a*4)):
print("in valid")
elif(b==(a*4)):
print("c:"+a)
print("d:0")
else:
while(c>0):
if(b<c*4):
c=c-1
b-=2
d=d+1
else:
if(b==c*4):
break
print(c)
print(d)