diff options
Diffstat (limited to 'reference/C/CONTRIB/OR_PRACTICAL_C/04_7.c')
-rw-r--r-- | reference/C/CONTRIB/OR_PRACTICAL_C/04_7.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/reference/C/CONTRIB/OR_PRACTICAL_C/04_7.c b/reference/C/CONTRIB/OR_PRACTICAL_C/04_7.c new file mode 100644 index 0000000..9116633 --- /dev/null +++ b/reference/C/CONTRIB/OR_PRACTICAL_C/04_7.c @@ -0,0 +1,13 @@ +#include <stdio.h> +char line[100]; /* input line from console */ +int value; /* a value to double */ + +main() +{ + (void) printf("Enter a value: "); + (void) fgets(line, sizeof(line), stdin); + (void) sscanf(line, "%d", &value); + (void) printf("Twice %d is %d\n", + value, value * 2); + return (0); +} |