PROGRAMMING- IN- C



CHECKING THE GRADE:


#include
#include
void main()
{
int a;
clrscr();
printf("enter the grade");
scanf("%d",&a);
if(a>=90)
{
printf("A grade");
}
else if((a>=80)&&(a<90 span="">
{
printf("B grade");
}
else if((a>=70)&&(a<80 span="">
{
printf("C grade");
}
else if((a>=60)&&(a<70 span="">
{
printf("D grade");
}
else if((a>=50)&&(a<60 span="">
{
printf("E grade");
}
else if(a<50 span="">
{
printf("fail");
}
getch();
}

TO CHECK PASS AND FAIL

#include
#include
void main()
{
int a;
clrscr();
printf("enter the marks");
scanf("%d",&a);
if(a>50)
{
printf("pass");
}
else
{
printf("fail");
}
getch();
}


CHECK LARGEST NUMBER OF TWO:


#include
#include
void main()
{
int a,b;
clrscr();
printf("enter the value of a");
scanf("%d",&a);
printf("\nenter the value of b");
scanf("%d",&b);
if(a>b)
{
printf("a is greater than b");
}
else
{
printf("b is greater than a");
}
getch();
}

PROGRAM TO CHECK LARGEST NUMBER BETWEEN THREE:


#include
#include
void main()
{
int a,b,c;
clrscr();
printf("enter the value of a");
scanf("%d",&a);
printf("\nenter the value of b");
scanf("%d",&b);
printf("enter the value of c");
scanf("%d",&c);
if(a>b)
{
   if(a>c)
  {
   printf("a is greatest number");
  }
  else if((b>c)&&(b>a))
   {
   printf("b is greatest number");
   }
   }
else
{
printf("c is the greatest number");
}
getch();
}
TO CHECK VOWELS:

#include
#include
void main()
{
char P,a,e,i,o,u;
clrscr();
printf("enter the value of P");
scanf("%s",&P);
if((P=='a')||(P=='e')||(P=='i')||(P=='o')||(P=='u'))
{
printf("P is a vowel");
}
else
{
printf("P is a consonant");
}
getch();
}

TO CALCULATE AVG AND AND CHECK GRADES:

#include
#include
void main()
{
float a,b,c,d,e,avg;
clrscr();
printf("enter the value of a");
scanf("%f",&a);
printf("\nenter the value of b");
scanf("%f",&b);
printf("\nenter the value of c");
scanf("%f",&c);
printf("\nenter the value of d");
scanf("%f",&d);
printf("\nenter the value of e");
scanf("%f",&e);
avg=(a+b+c+d+e)/5;
printf("\nthe avg is");
printf(“%f”,avg);
if(avg>90)
{
printf("A grade");
}
else
{
printf("b is greater than a");
}
getch();
}

No comments:

Post a Comment