jaredec18

Untitled

Sep 20th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3.  
  4. int main(void) {
  5. int userNum;
  6. bool isPositive;
  7. bool isEven;
  8.  
  9. scanf("%d", &userNum);
  10. isPositive = (userNum > 0);
  11. isEven = ((userNum % 2) == 0);
  12.  
  13. if(isPositive && isEven){
  14. printf("Positive even number");
  15. }
  16. else if(isPositive && !isEven){
  17. printf("Positive number");
  18. }
  19. else{
  20. printf("Not a positive number");
  21. }
  22. printf("\n");
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment