fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. return 0;
  6. }
  7. // Function validates an Irish license plate.
  8. // Returns 1 if valid, otherwise returns 0.
  9. int irishLicensePlateValidator(int year, int halfYear, char county, int sequenceNumber)
  10. {
  11. // Check year is between 13 and 24
  12. if (year < 13 || year > 24)
  13. return 0;
  14.  
  15. // Check half year is 1 or 2
  16. if (halfYear != 1 && halfYear != 2)
  17. return 0;
  18.  
  19. // Check county code
  20. switch (county)
  21. {
  22. case 'C':
  23. case 'c':
  24. case 'D':
  25. case 'd':
  26. case 'G':
  27. case 'g':
  28. case 'L':
  29. case 'l':
  30. case 'T':
  31. case 't':
  32. case 'W':
  33. case 'w':
  34. break;
  35. default:
  36. return 0;
  37. }
  38.  
  39. // Check sequence number is 1 to 999999
  40. if (sequenceNumber < 1 || sequenceNumber > 999999)
  41. return 0;
  42.  
  43. return 1;
  44. }
  45.  
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
Standard output is empty