Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <stdio.h>
  2. #include<ctype.h>
  3. int main()
  4. {
  5. int input;
  6. int valid = 2; // 2 for unused value // valid is the checking of string
  7. int count = 0;
  8. printf("Enter the decimal input :");
  9. scanf("%d",&input);
  10. if (input)
  11. {
  12.  
  13. if (input % 2 == 0)
  14. {
  15. valid = 1;
  16. }
  17. else
  18. {
  19. valid = 0;
  20. }
  21. }
  22. else
  23. {
  24. printf("Your inputs should be atleast 3.");
  25. }
  26. switch (valid)
  27. {
  28. case 1:
  29. {
  30. printf("Congrats, Your string is valid \n");
  31. break;
  32. }
  33. case 0:
  34. {
  35. printf("Your string is not valid\n");
  36. break;
  37. }
  38. }
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement