Advertisement
sellmmaahh

OR-2007-tablica-string

Aug 11th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1.  
  2. #include<stdio.h>
  3.  
  4.  
  5.  
  6.   int ispravna(char *tablica) {
  7.       char *p=tablica;
  8.       int i=0;
  9.     if ((*(p)>='0' && *p<='9') && (*(p+1)>='0' && *(p+1)<='9') && (*(p+2)>='0' && *(p+2)<='9') && *(p+3)=='-' && (*(p+4)>='A' && *(p+4)<='Z') && *(p+5)=='-' && (*(p+6)>='0' && *(p+6)<='9') && (*(p+7)>='0' && *(p+7)<='9') && (*(p+8)>='0' && *(p+8)<='9'))
  10.         return 1;
  11.     else return 0;
  12.   }
  13.  
  14.  
  15.   int main () {
  16.       char tab[]="234-A-567";
  17.       printf("%d",ispravna(tab));
  18.       return 0;
  19.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement