Buy Please || codechef ||Problem Code: BUYPLSE


Buy Please :

             



QUESTION STATEMENT :

 the chef went to a shop and buys A pens and B pencils. Each pen costs XX units and each pencil costs YY units. Now find what is the total amount  Chef will spend to buy A pens and B pencils.

    



code: 

we can use any language but most of them are using python,c/c++, java.

a,b,c,d=map(int,input().split())

#print(a,b,c,d)

print(a*b+c*d)


the above code is perfectly running. Here, you can see the map function which is used for getting inputs in one line. here the special term is .split() what it will do is, if your typing the inputs in space after another one. it will accept your input values. After that, I just print the elements.





No comments:

Post a Comment