Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- int main() {
- char str[7];
- int i;
- int flag=1;
- puts("Enter six digits without any space...");
- gets(str);
- for(i; i<6; i++) {
- if(isdigit(str[i])==0) {
- flag=0;
- }else if(ispunct(str[i])) {
- printf("Punctuation found \n");
- }else if(isspace(str[i])) {
- printf("Space found \n");
- }else if(isalpha(str[i])) {
- printf("Letter found %c \n", toupper(str[i]));
- }
- }
- (flag) ? puts("Entry valid") : puts("Entry invalid");
- printf("%d", flag);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement