Learning by doing: Reading books and trying to understand the (code) examples
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
330 B

  1. #include <stdio.h>
  2. #include <limits.h>
  3. int main (void) {
  4. unsigned age;
  5. printf("Enter your age: ");
  6. scanf("%u", &age);
  7. if ((unsigned int)(UINT_MAX / 3.156e7) < age) {
  8. printf("Integer overflow\n");
  9. return 1;
  10. } else {
  11. printf("You are %u seconds old\n", (unsigned int)(age * 3.156e7));
  12. }
  13. return 0;
  14. }