12.07.2015 Views

Chapitre 13 Quelques exemples de programmes

Chapitre 13 Quelques exemples de programmes

Chapitre 13 Quelques exemples de programmes

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

26 #inclu<strong>de</strong> // ne pas oublier pour l'utilisation <strong>de</strong>s fonctions mathématiques#inclu<strong>de</strong> int main () {float pi=3.14159;int i=10;// déclaration + initialisationint j;// déclaration seule (pas d'initialisation)// Attention, bien mettre %f et non pas %dprintf ("pi vaut environ: %f",pi);printf("\n i vaut:%d\n",i);printf("\n entrez une valeur:");scanf("%d",&j);// Attention à ne pas oublier le &printf("\n vous venez d'entrer %d",j);return 0;}– Nous compilerons ce programme comme ceci 1 : gcc -o programme1 programme1.c -lm– Nous le lancerons comme ceci : ./programme11. Même si, en l’occurence nous n’utilisons pas <strong>de</strong> fonctions <strong>de</strong> la librairie mathématique.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!