Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- #include <stdbool.h>
- int main(void) {
- const char *string[] = {"abcdefg", "abc,defg", "12abcdefghi", "ABCDE"};
- for (int i = 0; i < sizeof(string) / sizeof(char *); i++) {
- int len = strlen(string[i]);
- printf("String: %s, length: %d", string[i], len);
- if (len < 5 || len > 10) {
- puts("");
- continue;
- }
- bool except = false;
- for (int j = 0; string[i][j]; j++)
- if (!isalnum(string[i][j])) except = true;
- if (except) {
- puts("");
- continue;
- }
- puts(", week");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement