Serie9_cor - Srie 9 corrig 20 novembre 2008 Exercice 1 1...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Série 9 corrigé 20 novembre 2008 Exercice 1 1. #include <stdio.h> int main(int argc, char **argv) { int i, min, max; int t[10]; for (i=0; i<10; i++) { printf("Numero %d : ",i+1); scanf("%d",&t[i]); } max=min=t[0]; for (i=1;i<10;i++) { if (t[i] > max ) max = t[i]; if (t[i] < min ) min = t[i]; } printf("valeur max : %d\n",max); printf("valeur min : %d\n",min); return 0; } 2. #include <stdio.h> int main(int argc, char **argv) { int i, min, max; int t[10]; for (i=0; i<10; i++) { printf("Numero %d : ",i+1); scanf("%d",t+i); } max=min=*t; for (i=1;i<10;i++) { if (*(t+i) > max ) max = *(t+i); if (*(t+i) < min ) min = *(t+i); } printf("valeur max : %d\n",max); printf("valeur min : %d\n",min); return 0; }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Exercice 2 - Fonctions et tableaux 2. Le tableau n’ayant pas été initialisé, lorsqu’on cherche à afficher son contenu on affiche n’importe quoi. 3. Lorsqu’on alloue dynamiquement la mémoire pour le tableau, les éléments du tableau sont initialisés à zéro. Malloc
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/08/2010 for the course CH 3123 taught by Professor -- during the Fall '08 term at Ecole Polytechnique Fédérale de Lausanne.

Page1 / 4

Serie9_cor - Srie 9 corrig 20 novembre 2008 Exercice 1 1...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online