Un ptt exercice que j'avais donn�
i=1
while [ $i -lt 11 ] ; do
> resultat.$i
n=1
echo Table de multiplication de $i : >> resultat.$i
echo -------------------------------- >> resultat.$i
echo >> resultat.$i
while [ $n -lt 11 ] ; do
echo $i*$n = $(($i*$n)) >> resultat.$i
n=$[$n+1]
done
i=$[$i+1]
done
Cre� les tables de multiplication 1 --> 10
Dominique
|---------+----------------------------->
| | Arnaud Vandyck |
| | <[EMAIL PROTECTED]|
| | g.ac.be> |
| | Sent by: |
| | [EMAIL PROTECTED]|
| | unixtech.be |
| | |
| | |
| | 05/03/2003 14:32 |
| | Please respond to |
| | linux |
| | |
|---------+----------------------------->
>-------------------------------------------------------------------------------------------------------------------------------|
|
|
| To: [EMAIL PROTECTED]
|
| cc: (bcc: Dominique Gallot/BRU/MASTERCARD)
|
| Subject: [linux] Nombres premiers en bash ;-)
|
>-------------------------------------------------------------------------------------------------------------------------------|
On peut tout faire sous Linux ;-)
-- Arnaud Vandyck
<http://vbstefi60.fapse.ulg.ac.be/~arnaud/>
<http://www.ulg.ac.be/cgi-bin/ph/search?id=u184137>
�O� est pass� Bob?..�
#! /bin/bash
# nbrprm par Arnaud Vandyck (c) 2003 pour STE-Formations Informatiques
# $Id$
# This program prints the 100 first primary numbers (nombres premiers)
MAX=100;
DIVISEUR=4;
NB=3;
echo -n "1 2 3 ";
while (( NB<=MAX ));
do
ISNBRPRM=1;
QUOT=2;
while (( QUOT<DIVISEUR )) && (( ISNBRPRM!=0));
do
ISNBRPRM=$(( $DIVISEUR%$QUOT ));
QUOT=$(( $QUOT+1 ));
done;
if (( ISNBRPRM!=0 ));
then
NB=$(($NB+1));
echo -n "$DIVISEUR ";
fi
DIVISEUR=$(($DIVISEUR+1));
done;
echo "";
exit 0;
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
_______________________________________________________
Linux Mailing List - http://www.unixtech.be
Subscribe/Unsubscribe: http://www.unixtech.be/mailman/listinfo/linux
Archives: http://www.mail-archive.com/[EMAIL PROTECTED]
IRC: efnet.unixtech.be:6667 - #unixtech