TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Concept of Logical Operators in C program Example
Krishna Rajput Singh
Aug 21
2015
Code
1.1
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
#include<stdio.h>
#include<conio.h>
main()
{
int
a,b,c;
// local variable assign
printf(
"Enter the number of a\n"
);
printf(
"Enter the number of b\n"
);
printf(
"Enter the number of c\n"
);
scanf(
"%d"
,&a);
scanf(
"%d"
,&b);
scanf(
"%d"
,&c);
if
(a>b || a>c)
// using OR operator if any one condition is true print if statement otherwise else print.
{
printf(
"a is greater number\n"
);
}
else
printf(
"b and c are greater number of a\n"
);
{
if
(b>c && b>a)
// using AND operator if both condition are true then print if statement otherwise else print.
{
printf(
"b is greater number\n"
);
}
else
printf(
"a & c are greater number of b\n"
);
{
if
(c>a != c>b)
// using NOT no full-fill any condition always print false like else statement.
{
printf(
"c is greater number\n"
);
}
else
printf(
"a & b are greater number of c\n"
);
}
}
}
Opeartors
C programming