diff options
Diffstat (limited to 'wk2/sect/alpha.c')
-rw-r--r-- | wk2/sect/alpha.c | 20 |
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"); +} |