summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-07-20 19:44:30 -0600
committermo khan <mo@mokhan.ca>2014-07-20 19:44:30 -0600
commit0eadb61bdce7552e2f1a64aea79cee3be0e9fe23 (patch)
tree6df1d3cc23ee259b87983cc8b834e3066c2f68e5
parent93569fdf640e2c03cee1a92d292ea6c6fc9e73c9 (diff)
add input example.
-rw-r--r--input.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/input.c b/input.c
new file mode 100644
index 0000000..c700591
--- /dev/null
+++ b/input.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <string.h>
+
+int main(int argc, const char *argv[])
+{
+ char message[20];
+ int count, i;
+
+ strcpy(message, "Hello, world!");
+ printf("Repeat how many times?");
+ scanf("%d", &count);
+
+ for (i = 0; i < count; i++) {
+ printf("%3d - %s\n", i, message);
+ }
+
+ return 0;
+}