logoISU  

CS256 - Principles of Structured Design

Fall 2021

Displaying ./code/sternflCode/p8.c

#include<stdio.h>

//Cross the street
//offer some advice
int main() {
  int age;
  printf("Please enter your age (whole number) > ");
  scanf("%d", &age);
  if (age<4  || age> 81) {  // || is read as or
                            //only time it is false is if both parts are false
                            //in that case the else is executed
     printf("Don't cross the street by yourself. Its not safe\n");
     printf("Ask an adult to help you\n");
  }
  else
     printf("You can cross the street by your self\n");
}