Saturday, 13 December 2014

C PROGRAM FOR GRADING SCHEME USING SWITCH CASE

Write a program to find grading scheme using (switch statement):

#include<stdio.h>
#include<conio.h>
int main()
{
int marks;
clrscr();
printf("Enter the marks of the students");
scanf("%d",&marks);
marks=marks/10;
switch(marks)
{
case 10:
case 9:
case 8:
       printf("The grade is Honors");
       break;
case 7:
case 6:
       printf("The grade is 1st Division");
       break;
case 5:
       printf("The grade is 2nd Division");
       break;
case 4:
       printf("The grade is 3rd Division");
       break;
default:
       printf("Student is failed");
}
getch();
return(0);
}

OUTPUT:
Enter the marks of the student
72
The grade is 1st Division

9 comments:

  1. 6. Create an array that can hold 10 student grade out of 100 mark. Accept the grade from the user to fill the array and display the data. Also count and display how many students score <=50 and how many score >50. (use for loop for array manipulation and switch to count the number of student who score <=50 and >50)

    ReplyDelete
  2. #include

    using namespace std;

    int main()
    {
    int grade[10];
    for(int i= 1 ; i<= 10 ; i++ ){
    cout << "Enter the number of Grade " << i << " :" << endl;
    cin >> grade[i];
    }
    int below = 0 ,above = 0;
    for(int i = 1 ; i <= 10 ; i++){
    if (grade[i] <= 50){
    below++;
    }
    else
    {
    above++;
    }
    }

    cout << " how many students score <=50 : "<50 : " << above << else

    ReplyDelete
  3. How you assign case to percentage

    ReplyDelete
  4. no no its so bad not good bruh..❗🙂

    ReplyDelete
  5. Marks 0-20,20-40,40-60,60-80,80-100
    grade E ,D ,C ,B ,A
    Using switch statement to display the grade as per following criteria

    ReplyDelete
  6. If the mark is divided by 10.we will get 7.2.It's not exact 7.so why it will work.

    ReplyDelete
  7. If the mark is divided by 10.we will get 7.2.It's not exact 7.so why it will work.

    ReplyDelete