Created
January 25, 2015 17:52
-
-
Save AbhishekGhosh/847323ec7d35c678fa26 to your computer and use it in GitHub Desktop.
Pyramid Ball Count per Layer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# If there are 4 layers, run 3 times and add 1 | |
# GNU GPL 3.0 | |
# Dr. Abhishek Ghosh 2015 | |
echo "What is the number of Layer counted from the Top?:" | |
read input | |
echo "Then the $input th layer will have ::" | |
echo "\x1B[36m$(((input * 2)+((input - 2)*2)+((input - 2)*2)))\x1B[0m balls, if it is solid," | |
echo "and \x1B[36m$(((input*2)+((input - 2)*2)))\x1B[0m balls, if it is hollow!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment