Kamis, 07 Maret 2019

Use of logical operators in c language

in this article, I share with you little code of C programming that how logical operators work.

this is an example of Marksheet where I use logical operators.


Use of logical operators in c language

#include<conio.h>
#include<stdio.h>
main()
{
      //Use of logical operator &&
     
     
      int obt_matric,obt_inter,max_matric,max_inter;
      float per_matric,per_inter;
     
      printf("Enter matriculation obtained:");scanf("%d",&obt_matric);
      printf("Enter matriculation maximum:");scanf("%d",&max_matric);
      printf("Enter intermediate obtained:");scanf("%d",&obt_inter);
      printf("Enter intermediate maximum:"); scanf("%d",&max_inter);
     
      per_matric = obt_matric*100/max_matric;
      per_inter = obt_inter*100/max_inter;
     
      if(per_matric>=80 && per_inter>=80)
      printf("Congratulation! you got double top A-1 Grade in matric And Inter");
      else
      printf("You fail to got double top"); 
     
     
      getch();} 




Tidak ada komentar:

Posting Komentar