Pages

Thursday, June 16, 2016

C Program to demonstrate use of logical AND operator


#include<stdio.h>
int main()
{
int a, b;

printf("Enter number a:");
scanf("%d",&a);

printf("Enter number b:");
scanf("%d",&b);

if(a > 0 && b > 0)
{
printf("Both are positive numbers.");
}
else
{
printf("Both are not positive numbers.");
}
return 0;
}

Output of program

Enter number a:5
Enter number b:-7
Both are not positive numbers.

No comments:

Post a Comment