fork download
  1. #include <stdio.h>
  2.  
  3. int validateIrishLicense(int year, int halfYear, char County, int Sequence1);
  4.  
  5. int main(void) {
  6. int valid=validateIrishLicense(13,1,'D',21);
  7. printf("The license is valid or not (1=valid, 0=no): %i\n", valid);
  8. return 0;
  9. }
  10.  
  11. int validateIrishLicense(int year, int halfYear, char County, int Sequence1){
  12.  
  13. int check=0;
  14.  
  15. if (year>=13 & year<=24){
  16. check=+1;
  17. }
  18.  
  19. if (halfYear==1 | halfYear==2){
  20. check+=1;
  21. }
  22.  
  23. char valid_county[]= {'C','c','D','d','G','g','L','l','T','t','W','w'};
  24. const VAL_COUNTIES=12;
  25.  
  26. // for (int i=0; i < VAL_COUNTIES; i++) {
  27. if (County=='D'){
  28. check=+1;
  29. printf("The license is valid or not (1=valid, 0=no): %i\n", check);
  30. // return check;
  31. }
  32. // }
  33.  
  34. // if (check==3){
  35. // return 1;
  36. // }
  37. // else{
  38. // return 0;
  39. // }
  40. }
  41.  
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
The license is valid or not (1=valid, 0=no): 1
The license is valid or not (1=valid, 0=no): 0