BUT2/SCR/SCR1.2/TD06/reponses.txt

15 lines
307 B
Plaintext
Raw Permalink Normal View History

2023-10-23 13:23:36 +02:00
le script convertis le 2eme arg en base 10
l=$(expr length $2)
pos=1;
for ((pow=l-1;pow>=0;pow--))
do
digit=$(expr substr $2 pos 1)
digit=(($(expr index $LEGAL_DIGITS $digit)-1))
if [[digit -eq 0 ]]
then
echo "Authorized digits are : $LEGAL_DIGITS"; exit
fi
decimal=((resultat+digit*&1**pow))
done