diff --git a/02-add_nums.sh b/02-add_nums.sh index 2fd13cb5..c95144f2 100644 --- a/02-add_nums.sh +++ b/02-add_nums.sh @@ -13,3 +13,10 @@ echo "The sum is $sum" # exercise: ask the user for the width and height and present total # number of pixels + +echo "What is the picture's width" +read width +echo "And what'll the picture's height be?" +read height +total=$((width * height)) +echo "The total number of pixels is $total" diff --git a/tk_01CreatedFile b/tk_01CreatedFile new file mode 100644 index 00000000..e69de29b diff --git a/tk_NetworkGraph.PNG b/tk_NetworkGraph.PNG new file mode 100644 index 00000000..2da745dd Binary files /dev/null and b/tk_NetworkGraph.PNG differ diff --git a/tk_rng.sh b/tk_rng.sh new file mode 100644 index 00000000..9b9f8016 --- /dev/null +++ b/tk_rng.sh @@ -0,0 +1,27 @@ +#!/bin/bash +echo "Taisann Kham" +echo "Hello, welcome to Taisann's RNG guessing game" +echo "Please choose a number between 0 - 9" +RANGE=10 +rand=0 +rand=$RANDOM +let "rand %= $RANGE" +read input +loop=false +while [[ $loop != q ]]; do + if [[ $input -lt $rand ]]; then + echo "Your number is smaller than the correct number" + fi + if [[ $input -gt $rand ]]; then + echo "Your number is bigger than the correct number" + fi + if [[ $input -eq $rand ]]; then + loop=q + echo "Congratulations! You guessed the correct number, $rand!" + fi + if [[ $loop != q ]]; then + echo "Please choose a new number" + read input + fi +done +