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;
}

4 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
  3. #include
    #include

    int main()
    {
    int a,b,c,d,e,f;
    float total,per;
    printf("the marksheet of half yearly");
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
    total = a+b+c+d+e+f;
    printf("the total marks is %.2f\n",total);
    per = total/600*100;
    printf("the percentage marks is %f\n",per);
    if(per<=40)
    printf("just pass/n");
    else if (per >= 50&& per<59)
    printf("pass");
    else if (per>=60&& per<70)
    printf("first");
    else if (per>=70 && per <79)
    printf("distinction");
    else if (per>=80 && per <100)
    printf("Double distinction");
    return 0;
    }


    jus take idea it may help

    ReplyDelete