fork download
  1. #include <stdio.h>
  2.  
  3. // This function simulates a simple decision tree
  4. void should_i_go_to_the_beach(int temperature, int is_sunny) {
  5. printf("Temperature is %d°F and is_sunny is %d\n\n", temperature, is_sunny);
  6.  
  7. if (temperature > 70) {
  8. if (is_sunny == 1) {
  9. printf("✅ Heck yeah! Go to the beach!\n");
  10. } else {
  11. printf("🤔 It's warm, but not sunny. Maybe a walk instead?\n");
  12. }
  13. } else {
  14. printf("❌ Nah, it's too cold for the beach.\n");
  15. }
  16. }
  17.  
  18. int main() {
  19. // What if it's 80°F and sunny?
  20. should_i_go_to_the_beach(80, 1);
  21.  
  22. // What if it's 60°F and sunny?
  23. should_i_go_to_the_beach(60, 1);
  24.  
  25. return 0;
  26. }
  27.  
  28.  
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
Temperature is 80°F and is_sunny is 1

✅ Heck yeah! Go to the beach!
Temperature is 60°F and is_sunny is 1

❌ Nah, it's too cold for the beach.