Advertisement
Guest User

Untitled

a guest
Oct 18th, 2020
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4.  
  5. int main() {
  6.     char str[7];
  7.     int i;
  8.     int flag=1;
  9.  
  10.     puts("Enter six digits without any space...");
  11.     gets(str);
  12.  
  13.     for(i; i<6; i++) {
  14.         if(isdigit(str[i])==0) {
  15.             flag=0;
  16.         }else if(ispunct(str[i])) {
  17.             printf("Punctuation found \n");
  18.         }else if(isspace(str[i])) {
  19.             printf("Space found \n");
  20.         }else if(isalpha(str[i])) {
  21.             printf("Letter found %c \n", toupper(str[i]));
  22.         }
  23.     }
  24.  
  25.     (flag) ? puts("Entry valid") : puts("Entry invalid");
  26.     printf("%d", flag);
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement