fork download
  1. #include <stdlib.h>
  2. #include <time.h>
  3. #include <stdio.h>
  4. /**
  5.  * main - Entry point
  6.  * Return: Always return 0 (Success)
  7.  */
  8. int main(void)
  9. {
  10. int n;
  11.  
  12. int m;
  13.  
  14. srand(time(0));
  15. n = rand() - RAND_MAX / 2;
  16. m = n % 10;
  17. if (m > 5)
  18. printf("Last digit of %d is %d and is greater than 5\n", n, m);
  19. if (m == 0)
  20. printf("Last digit of %d is %d and is 0\n", n, m);
  21. if (m < 6 && m != 0)
  22. printf("Last digit of %d is %d and is less than 6 and not 0\n", n, m);
  23. return(0);
  24. }
  25.  
Success #stdin #stdout 0s 5448KB
stdin
 
stdout
Last digit of 114799396 is 6 and is greater than 5