Posted on Leave a comment

Using if & else control instructions

using if else control instructions

  1. #include <stdio.h>
  2. int main()
  3. {
  4.    int x = 1;
  5.    if (x == 1)
  6.       printf(“x is equal to one.\n”);
  7.    else
  8.       printf(“For comparison use ‘==’ as ‘=’ is the assignment operator.\n”);
  9.    return 0;
  10. }

Output:

**********************************************
x is equal to one.

**********************************************

Leave a Reply

Your email address will not be published. Required fields are marked *