C language is a middle level language. It is a structured language. C language is a case sensitive language. All syntax written in c language is in lower case. C is the basis for C++.


What is C C vs C++ vs Java Program Structure Data Types in C Basic Rules of C & C++
Functions in C If, Else Conditions Loops in C Switch Case Arrays
Pointers Structures in C Strings in C Command Line Arguments Type Casting
Linked Lists Recursion Binary Trees Inheritance Multiple Inheritance
Templates File I/O Object Oriented Programming Data Structures in C C interview Questions

IF ELSE, ELSE IF Statement in C language

if (condition)
// executed only if "condition" is true
else if (other condition)
// executed only if "condition" was false and "other condition" is true
// executed only if both "condition" and "other condition" were false

For example you have to print a message if student scores less than 50, complete score of 100,& between 50-100.Here is how you will use these statements.

In above c program if number entered is less than 10 it will display the number otherwise it will say "Number is larger than 10".

Use of Logical Operators (Logical AND) && and (Logical OR) || with if else statements

If either of above conditions is true i.e a<b or b<c it will print the name else ABC will be printed. We can replace the Logical OR operator || with && in the above program.

then the name will be printed only if both conditions satisfy. a<b && b<c.

Here is another e.g in C++

if ( score < 50 ) {                  // If the Score is less than 50 you are not allowed
     cout<<"You are Not Allowed!\n"; //
  else if ( score == 100 ) {            // If score is 100 print u are flawless
     cout<<"You are Flawless\n";         
  else {
    cout<<"You are good\n";     //