if2.c

  #include <stdio.h>

  int main()
  {
     int age;
     printf("Acme movie theatre\n");
     printf("Input your age: ");
     scanf("%d", &age);
     if (age < 21)
     {
         printf("You are too young to watch this movie.\n");
     } else
     {
         printf("You are old enough to watch this movie.\n");
     }
     return 0;
  }
  • Try to run this program.
  • Now, if you input the age with 21 or more, you get the message.
  • Let's see another example.

 


Where to go

Chapter 2
News Page
Lesson 1 contents
Contacting Me


Roby Joehanes © 2001