Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions 02-add_nums.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Empty file added tk_01CreatedFile
Empty file.
Binary file added tk_NetworkGraph.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions tk_rng.sh
Original file line number Diff line number Diff line change
@@ -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