summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2023-12-01 05:35:48 +0000
committerFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2023-12-01 05:35:48 +0000
commitb2453faff43249953dddf17d04b46a9ea201c804 (patch)
tree7dd818bdbb0255f42cd37335a18cba2aa4006afb
parent6c239dc828d73b974b51109db65765beaca4a354 (diff)
Thu, Nov 30, 2023, 9:35 PM -08:00
-rw-r--r--agree.c15
-rw-r--r--compare.c28
2 files changed, 29 insertions, 14 deletions
diff --git a/agree.c b/agree.c
new file mode 100644
index 0000000..48302d2
--- /dev/null
+++ b/agree.c
@@ -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");
+ }
+}
diff --git a/compare.c b/compare.c
index 6c436bf..8511597 100644
--- a/compare.c
+++ b/compare.c
@@ -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");
+ }
}