Compare commits
3 Commits
12dd97e614
...
6fff53bc0c
| Author | SHA1 | Date | |
|---|---|---|---|
| 6fff53bc0c | |||
| 841be2bee6 | |||
| 2eb903e6bc |
75
.gitignore
vendored
Normal file
75
.gitignore
vendored
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
|
||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/linux,windows,macos
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=linux,windows,macos
|
||||||
|
|
||||||
|
### Linux ###
|
||||||
|
*~
|
||||||
|
|
||||||
|
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||||
|
.fuse_hidden*
|
||||||
|
|
||||||
|
# KDE directory preferences
|
||||||
|
.directory
|
||||||
|
|
||||||
|
# Linux trash folder which might appear on any partition or disk
|
||||||
|
.Trash-*
|
||||||
|
|
||||||
|
# .nfs files are created when an open file is removed but is still being accessed
|
||||||
|
.nfs*
|
||||||
|
|
||||||
|
### macOS ###
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
### Windows ###
|
||||||
|
# Windows thumbnail cache files
|
||||||
|
Thumbs.db
|
||||||
|
Thumbs.db:encryptable
|
||||||
|
ehthumbs.db
|
||||||
|
ehthumbs_vista.db
|
||||||
|
|
||||||
|
# Dump file
|
||||||
|
*.stackdump
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
[Dd]esktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msix
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/linux,windows,macos
|
||||||
@@ -1,2 +1,6 @@
|
|||||||
# Triangles
|
# Triangles
|
||||||
|
|
||||||
|
## Descrizione esercizio
|
||||||
|
|
||||||
|
Dato un numero intero n, produrre in output un triangolo rettangolo in cui i cateti sono lunghi n e il perimetro sia delineato con il carattere * in ogni punto.
|
||||||
|
I cateti devono essere in alto e a sinistra. Esempio, dato n=5:
|
||||||
|
|||||||
39
Triangles.sh
Executable file
39
Triangles.sh
Executable file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Dato un numero intero n, produrre in output un triangolo rettangolo in cui i
|
||||||
|
# cateti sono lunghi n e il perimetro sia delineato con il carattere * in ogni punto.
|
||||||
|
# I cateti devono essere in alto e a sinistra. Esempio, dato n=5:
|
||||||
|
|
||||||
|
echo -n "Lato triangolo: "
|
||||||
|
read lato
|
||||||
|
printf "\n"
|
||||||
|
|
||||||
|
if [ $lato == 1 ]
|
||||||
|
then
|
||||||
|
echo "*"
|
||||||
|
elif [ $lato == 2 ]
|
||||||
|
then
|
||||||
|
echo "**"
|
||||||
|
echo "*"
|
||||||
|
elif [ $lato -lt 1 ]
|
||||||
|
then
|
||||||
|
echo "Lato non valido"
|
||||||
|
else
|
||||||
|
printf "%0.s*" $(seq 1 $lato)
|
||||||
|
printf "\n"
|
||||||
|
|
||||||
|
for i in $(seq 1 $(( $lato - 1 )))
|
||||||
|
do
|
||||||
|
printf "*"
|
||||||
|
spazi=$(( $lato - $i - 2 ))
|
||||||
|
if [ $spazi -gt 0 ]
|
||||||
|
then
|
||||||
|
printf "%0.s " $(seq 1 $spazi)
|
||||||
|
fi
|
||||||
|
if [ $spazi -gt -1 ]
|
||||||
|
then
|
||||||
|
printf "*\n"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
printf "\n"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user