grains is easy

This commit is contained in:
Rorik Star Platinum 2025-12-10 18:04:56 +03:00
parent be07d4421e
commit 34eb2e1c4e
7 changed files with 247 additions and 0 deletions

51
rust/grains/README.md Normal file
View file

@ -0,0 +1,51 @@
# Grains
Welcome to Grains on Exercism's Rust Track.
If you need help running the tests or submitting your code, check out `HELP.md`.
## Introduction
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 chessboard, with the number of grains doubling on each successive square.
## Instructions
Calculate the number of grains of wheat on a chessboard.
A chessboard has 64 squares.
Square 1 has one grain, square 2 has two grains, square 3 has four grains, and so on, doubling each time.
Write code that calculates:
- the number of grains on a given square
- the total number of grains on the chessboard
## Source
### Created by
- @IanWhitney
### Contributed to by
- @ClashTheBunny
- @coriolinus
- @cwhakes
- @efx
- @ErikSchierboom
- @krodyrobi
- @lutostag
- @navossoc
- @nfiles
- @petertseng
- @rofrol
- @stringparser
- @TheDarkula
- @xakon
- @ZapAnton
### Based on
The CodeRanch Cattle Drive, Assignment 6 - https://web.archive.org/web/20240908084142/https://coderanch.com/wiki/718824/Grains