Quels seront les résultats fournis par ce programme :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include main () { int n = 543 ; int p = 5 ; float x = 34.5678; printf ( "A : %d %f\n" , n, x) ; printf ( "B : %4d %10f\n" , n, x) ; printf ( "C : %2d %3f\n" , n, x) ; printf ( "D : %10.3f %10.3e\n" , x, x) ; printf ( "E : %-5d %f\n" , n, x) ; printf ( "F : %*d\n" , p, n) ; printf ( "G : %*.*f\n" , 12, 5, x) ; printf ( "H : %x : %8x :\n" , n, n) ; printf ( "I : %o : %8o :\n" , n, n) ; } |
La correction exercice C/C++ (voir page 2 en bas)