diff options
-rw-r--r-- | agree.c | 15 | ||||
-rw-r--r-- | compare.c | 28 |
2 files changed, 29 insertions, 14 deletions
@@ -0,0 +1,15 @@ +#include <stdio.h> +#include <cs50.h> + +int main(void) +{ + char c = get_char("Do you agree? "); + if (c == 'y') + { + printf("Agreed.\n"); + } + else if (c == 'n') + { + printf("Not agreed.\n"); + } +} @@ -3,19 +3,19 @@ int main(void) { -int x = get_int("What's x? "); -int y = get_int("What's y? "); + int x = get_int("What's x? "); + int y = get_int("What's y? "); -if (x < y) -{ - printf("x is less than y\n"); -} -else if (x > y) -{ - printf("x is greater than y\n"); -} -else -{ - printf("x is equal to y\n"); -} + if (x < y) + { + printf("x is less than y\n"); + } + else if (x > y) + { + printf("x is greater than y\n"); + } + else + { + printf("x is equal to y\n"); + } } |