Correction du Contrôle continu d'Informatique IV 7 février 2022
Exercice 1 :
1) pow ( x +y ,2) + pow (y , z +1) +1/(1+ sqrt (1+ pow (z ,2) ) ) ;
2) Évaluons pour x = 1, y = 2, z = 3.
2·2
a) 1 + 1 1 3 9 13
3+1
2 ·3· 1+ 2 =1+ 2 ·3· 2 =1+ 4 = 4
b) (1 + 2 > 3) OR NOT (1 − 2 = 3) AND NOT (1 = 2) =⇒ Faux OR Vrai AND Vrai
(1 + 2 > 3) OR NOT (1 − 2 = 3) AND NOT (1 = 2) = Vrai
Exercice 2 :
void exo2 ( int m ) { s = 0;
int i ; i = 1;
float s ; while ( i <= m ) {
s = s + pow ( 2* i -1 , 2) /(2* i ) ;
s = 0; i ++;
for ( i = 1; i <= m ; i ++ ) { }
s = s + pow ( 2* i -1 , 2) /(2* i ) ; printf ( " Cette somme vaut : % f " , s )
} ;
printf ( " Somme obtenue : % f " , s ) ; }
}
Instructions m i s
Exercice 3 :
Lire (m) 4
s←0 0
void exo3 ()
Pour i = 1 faire 1 1/2 {
Pour i = 2 faire 2 11/4 float x ,y ;
Pour i = 3 faire 3 83/12
Pour i = 4 faire 4 313/24 printf ( " Entrez la valeur de x \ n " ) ;
i atteint m, scanf ( "% f " , & x ) ;
on sort de la boucle if ( x < 0 || x > 1 )
Écrire (s) Ache la valeur printf ( " Valeur incorrecte \ n " ) ;
nale de s else {
if ( x == 0 || x == 1 )
12 32 52 (2m−1)2 y = x;
s= 2 + 4 + 6 + ··· + 2m else
y = x * log ( x ) /( x -1) ;
void exo2 ( int m ) printf ( " y (% f ) = % f" ,x , y ) ;
{ }
int i ; }
float s ;
Exercice 4 :
# include < stdio .h > for ( i =0; i < NPOINTS ; i ++) {
# define NPOINTS 5 printf ( " numero : " ) ;
scanf ( " % d" , & courbe [ i ]. num ) ;
main () printf ( " x : " ) ;
{ scanf ( " % f" , & courbe [ i ]. x ) ;
struct point { printf ( " y : " ) ;
int num ; scanf ( " % f" , & courbe [ i ]. y ) ;
float x ; }
float y ; printf ( " **** Points obtenus ****\ n " ) ;
}; for ( i =0; i < NPOINTS ; i ++) {
struct point courbe [ printf ( " numero : % d x : % f y : % f \ n " ,
NPOINTS ] ; courbe [ i ]. num , courbe [ i ]. x , courbe [ i ]. y ) ;
int i ; }
}