C program to find the grade of your mark using SWITCH statement.

 

C program

C PROGRAM

C program to find the grade of your mark using SWITCH  statement

#include <stdio.h>
#include<conio.h>
void main()
{
  int marks;
  char grade;
  printf("Enter your mark out of 10 \n");
  scanf("%d",&marks);
  switch(marks)
  {
    case 10:
      grade='O';
      break;
    case 9:
      grade='s';
      break;
    case 8:
      grade='a';
      break;
    case 7:
      grade='b';
      break;
    case 6:
      grade='c';
      break;
    default:
      grade='f';
      }
      printf(" the grade for the given marks %c",grade);
      getch();
  }

OUTPUT :

Enter your mark out of 10 
9
 the grade for the given marks s
Process finished.


Comments

Popular posts from this blog

Write a program to calculate a students result based on two examinations, 1 sports event, and 3 activities conducted. The weightage of activities= 30%, sports= 20% , and examinations= 50%.

Determine the intensity of shear of an oil having viscosity= 1 poise. The oil is used for lubricating the clearance between a shaft of diameter 10 cm and its journal bearing. The clearance is 1.5mm and the shaft rotates at 150 r.p.m.