Pass or Fail( IF with Logical Operator && Example)
As earlier we have mentioned ‘if’ is used for decision making in Programming. Here is an example of ‘if’. We have also used Logical Operator && (All conditions must be true). Following program decides the result ‘pass’ or ‘fail’ based on given marks of three subjects.
#include<stdio.h>
#include<conio.h>
void main()
{
int eng,maths,sci;
clrscr();
printf("\n enter marks of three sub:");
scanf("%d %d %d",&eng,&maths,&sci);
if(eng>=33 && maths>=33 &&sci>=33)
{
printf("\n pass");
}
else
{
printf("\n fail");
}
getch();
}