Skip to content

ElitLabs/L2Practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Lesson 3 Practice

Instructions:

Farmer John has a pasture of a given length and width. He has a given number of cows on this pasture. Every $n$ square units of area on the pasture has enough grass to feed $m$ cows. Given the length and width of a pasture, $n$, and $m$, write a program that calculates the total number of cows that the pasture can support.

Input is to be given in order: length, width, $n$, $m$. Output the number of cows that the pasture can support to the console. Your output should be a whole number since fractional cows don't exist.

Example input 1:

5
6
2
1

Example output 1:

15

In the example above, the pasture would have an area of 5 x 6, which is 30 square units. It is given by the last 2 lines of the input that every 2 square units of area can feed 1 cow, so the total amount of cows the pasture can support is 15.

Example input 2:

7
10
7
3

Example output 2:

30

In the example above, the pasture would have an area of 7 x 10, which is 70 square units. It is given by the last 2 lines of input that every 7 square units of area can feed 3 cows, so the total amount of cows the pasture can support is 30.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published