4
Number to the cube
- #include <stdio.h>
- int cube( int x ) {
- return x*x*x;
- }
- main() {
- int n;
- printf("? ");
- while ( scanf("%d", &n) == 1 ) {
- printf(" = %d\n", cube( n ));
- printf("? ");
- }
- }
$ gcc -o cube cube.c
$ ./cube
? 3
= 27
? -3
= -27
? 0
= 0
? q
Comments