fork download
  1. #include <math.h>
  2. #include <stdio.h>
  3.  
  4. unsigned int isNatural(double num)
  5. {
  6. return ((num >= 0) && (0.0 == fmod(num, 1.0)));
  7. }
  8.  
  9. int main()
  10. {
  11. double num;
  12.  
  13. scanf("%lf", &num);
  14. printf("%s\n", isNatural(num) ? "Natural" : "Unnatural");
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 2012KB
stdin
10.0
stdout
Natural