|
|
8 년 전 | |
|---|---|---|
| .. | ||
| src | 8 년 전 | |
| tests | 8 년 전 | |
| README.md | 8 년 전 | |
Run cargo init in your task2/ directory.
Calculate the number of grains of wheat on a chessboard given that the number on each square doubles.
There once was a wise servant who saved the life of a prince. The king promised to pay whatever the servant could dream up. Knowing that the king loved chess, the servant told the king he would like to have grains of wheat. One grain on the first square of a chess board. Two grains on the next. Four on the third, and so on.
There are 64 squares on a chessboard.
Write code that shows:
fn square(n: u32) -> u64), andfn total() -> u64)Use the given file lib.rs for your solution.