Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int fyo, myo;
  5. int main()
  6. {
  7. int yyo, gmyo, gfyo;
  8. myo = -1;
  9. printf("How old are you?\n");
  10. scanf("%d",&yyo);
  11. if (yyo > 0){
  12. printf("You are %d years old\n", yyo);
  13. }
  14. else {
  15. printf("You is not exist.\n");
  16. }
  17. printf("How old is your father?\n");
  18. scanf("%d",&fyo);
  19. if (fyo > 0) {
  20. if (fyo > yyo) {
  21. printf("Your father is %d years old\n", fyo);
  22. printf("Your father was %d years old, when you was born.\n", fyo-yyo);
  23. }
  24. else {
  25. printf("Your father is young than you :D\n", fyo);
  26. }
  27. }
  28. else {
  29. printf("Your father is not exist.\n");
  30. }
  31. do {
  32. printf("How old is your mother?\n");
  33. scanf("%d",&myo);
  34. if (myo < 0 || myo < yyo) {
  35. printf("It's not correct.\n");
  36. }
  37. } while (myo < 0 || myo < yyo);
  38. switch (myo) {
  39. case 77: printf("Your mother and father are the same age"); break;
  40. default: printf("Your mother is %d years old\n", myo);
  41. printf("Your mother was %d years old, when you was born.\n", myo-yyo); break;
  42. }
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement