6
Saisie au clavier
- #include <stdlib.h>
- #include <stdio.h>
- main() {
- int age;
- printf( "Enter your age: " );
- if ( scanf("%d", &age) == 1 )
- printf("Next year you'll be %d.\n", age+1 );
- exit( 0 );
- }
$ gcc -o age age.c
$ ./age
Enter your age: 49
Next year you'll be 50.
$ ./age
Enter your age: ten
$
Commentaires