summaryrefslogtreecommitdiff
path: root/wk2/sect/alpha.c
diff options
context:
space:
mode:
authorFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-02-17 22:59:23 +0000
committerFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-02-17 22:59:23 +0000
commita2682d25c6cd0e069ff73a43df74c17a63caabac (patch)
treebc5621a5a4b99495a64e41d2407cc5cde22061de /wk2/sect/alpha.c
parentd3c2d73736cc188e7ad089bfb29d42bf29faf881 (diff)
Sat, Feb 17, 2024, 2:59 PM -08:00
Diffstat (limited to 'wk2/sect/alpha.c')
-rw-r--r--wk2/sect/alpha.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/wk2/sect/alpha.c b/wk2/sect/alpha.c
new file mode 100644
index 0000000..054950f
--- /dev/null
+++ b/wk2/sect/alpha.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <ctype.h>
+#include <cs50.h>
+#include <string.h>
+
+int main(void)
+{
+ string word = get_string("Word: ");
+ int l = strlen(word);
+ for (int i = 0; i < l - 1; i++)
+ {
+ // If NOT alphabetical
+ if (word[i] > word[i + 1])
+ {
+ printf("No\n");
+ return 0;
+ }
+ }
+ printf("Yes\n");
+}