Code for percentage in c language

Code for percentage in c language
Here is your code :


int main()

{
int physics;
int chemistry;
int maths;
int total;
    printf("enter the marks in physics =\n");
    scanf("%d",&physics);
    printf("enter the marks in chemistry =\n");
    scanf("%d",&chemistry);
    printf("enter thr marks in maths =\n");
    scanf("%d",&maths);
    total = (physics+ chemistry + maths)/3;
    {
    if((total <=40) || physics < 33 || chemistry<33 || maths<33)
    {
    printf("your percentage is =%d and you are fail \n",total);}
    else
    printf("your percentage is = %d and you are pass \n",total);
    return 0;
}
}

Keep learning keep studying 😇😇


Comments