Monday, February 17, 2020

using if else control instructions


#include <stdio.h>
int main()
{
  int n;
  printf("Enter a number\n");
  scanf("%d", &n);
  if (> 0)
    printf("Greater than zero.\n");
  else
    printf("Less than or equal to zero.\n");
  return 0;
}

Output:

Enter a number
-45
Less than or equal to zero.

No comments:

Post a Comment