Monday, December 19, 2011

Pass/fail check


/* A program to check whether a student is pass or fail */

#include <stdio.h>
int main()

{
    int thermo, drawing, chemistry, math, c,total;
    printf("\n Marks in:\n\n");
    printf(" thermo    = ");
    scanf("%d",&thermo);
    printf(" drawing   = ");
    scanf("%d",&drawing);
    printf(" chemistry = ");
    scanf("%d",&chemistry);
    printf(" math      = ");
    scanf("%d",&math);
    printf(" c         = ");
    scanf("%d",&c);
    total=math+thermo+chemistry+drawing+c;
    if(thermo<40 || chemistry<40 || drawing<40 || math<40 || c<40)
        printf("\n Result: FAIL");
    else
        printf("\n Result: PASS");
    printf("\n Percentage:%0.2f\n",total/5.0);
    printf("\n NOTE: Total for each subject is 100\n");
    return 0;
}

3 comments:

  1. Enter the final mark of a student and display “Pass” or “Fail”. Student should get more than 45 marks to pass a subject

    ReplyDelete
  2. Enter final marks and display fail in which subject

    ReplyDelete