Sunday, November 9, 2014

C Programming for Beginners 8 - if...else and Nested if...else stateme...

#include <stdio.h>
#include <stdlib.h>
int main()
 int age;
 printf("Please enter the age ");
 if (age > 18/* condition goes here */) {
      /* if the condition is non-zero (true), this code will execute */
      printf("The age is greater then 18 \n");
     if(age < 21)
         printf("The age is greater then 18 but less then 21");
       printf("The age is greater then 18 but not less then 21");

   } else if (age == 18)
       printf("The age is equal to 18");
   } else
      printf("The age is not greater then or equal to 18");

IT Certification Category (English)640x480

Partner Sites

Top Online Courses From ProgrammingKnowledge

Python Course
Java Course
Bash Course
Linux Course
C Course
C++ Course
PHP Course
Android Course
C# Course
JavaFx Course
NodeJs Course
Jenkins Course
Scala Course
Bootstrap Course
MongoDB Course
QT C++ GUI Course