Please give me a turbo c code on how to calculate grades with percentage.

This is not a "do my homework for me" forum.

Either show your effort to solve this assignment, or resign yourself to disappointment.

Post what all you have ..
How you going to calc grade using percentage thn anyone 'll help you

this is what i do..but pls help me because it cant run..


#include<stdio.h>
main()
{
int prelim,midterm,semifinals,finals;
int quizzes,assignments,project,attendance;
int exam,classstanding,total;
int sum,product,compute,grade;
clrscr();
printf("\n\n\n\t\t\t BSU GRADING SYSTEM");
printf("\n\n\n\t\t\t by ");
printf("\n\n\n\t\t\t THERESA DENISE MATALA");
getch();
clrscr();
printf("\t\t\t\t EXAM ");
printf("\n\n PRELIM: ");
scanf("%d",&prelim);
printf("\nMIDTERM: ");
scanf("%d",&midterm);
printf("\nSEMI FINALS: ");
scanf("%d",&semifinals);
printf("\nFINALS: ");
scanf("%d",&finals);
getch();
clrscr();
printf("\t\t\t\t CLASS STANDING ");
printf("\n\nQUIZZES: ");
scanf("%d",&quizzes);
printf("\nASSIGNMENTS: ");
scanf("%d",&assignments);
printf("\nPROJECT: ");
scanf("%d",&project);
printf("\nATTENDANCE: ");
scanf("%d",&attendance);
getch();
clrscr();
printf("\n\n\n\n\n\n\n\n COMPUTE ");
getch();
clrscr();
printf(" COMPUTATION ");
printf("\nEXAM%: ");
scanf("%d",&exam);
prelim=grade*0.12;
midterm=grade*0.12;
semifinals=grade*0.12;
finals=grade*0.24;
exam=prelim+midterm+semifinals+finals;
compute;
printf("\nCLASS STANDING%: ");
scanf("%d",&classstanding);
quizzes=grade*.5;
assignments=grade*.15;
project=grade*.15;
attendance=grade*.5;
compute;
printf("\nTOTAL: ");
scanf("%d",&total);
total=exam+classstanding;
getch();
}

Embed your program between code tags..

kindly post an example? pls..

In the future, ALWAYS use the code tags (icons are in the editing window of the forum). Just paste your code between the supplied [CODE ] [/CODE ] tags. (You get a pair of code tags by clicking on the [CODE ] icon.)

This is your program, formatted, and using code tags:

#include<stdio.h>

main()
{
    int prelim,midterm,semifinals,finals;
    int quizzes,assignments,project,attendance;
    int exam,classstanding,total;
    int sum,product,compute,grade;
    clrscr();
    printf("\n\n\n\t\t\t BSU GRADING SYSTEM");
    printf("\n\n\n\t\t\t by ");
    printf("\n\n\n\t\t\t THERESA DENISE MATALA");
    getch();
    clrscr();
    printf("\t\t\t\t EXAM ");
    printf("\n\n PRELIM: ");
    scanf("%d",&prelim);
    printf("\nMIDTERM: ");
    scanf("%d",&midterm);
    printf("\nSEMI FINALS: ");
    scanf("%d",&semifinals);
    printf("\nFINALS: ");
    scanf("%d",&finals);
    getch();
    clrscr();
    printf("\t\t\t\t CLASS STANDING ");
    printf("\n\nQUIZZES: ");
    scanf("%d",&quizzes);
    printf("\nASSIGNMENTS: ");
    scanf("%d",&assignments);
    printf("\nPROJECT: ");
    scanf("%d",&project);
    printf("\nATTENDANCE: ");
    scanf("%d",&attendance);
    getch();
    clrscr();
    printf("\n\n\n\n\n\n\n\n COMPUTE ");
    getch();
    clrscr();
    printf(" COMPUTATION ");
    printf("\nEXAM%: ");
    scanf("%d",&exam);
    prelim=grade*0.12;
    midterm=grade*0.12;
    semifinals=grade*0.12;
    finals=grade*0.24;
    exam=prelim+midterm+semifinals+finals;
    compute;
    printf("\nCLASS STANDING%: ");
    scanf("%d",&classstanding);
    quizzes=grade*.5;
    assignments=grade*.15;
    project=grade*.15;
    attendance=grade*.5;
    compute;
    printf("\nTOTAL: ");
    scanf("%d",&total);
    total=exam+classstanding;
    getch();
}

Don't you want to use loops to have the data entered into the program? Or is each student going to have just one quiz mark, one test mark, etc.?

no..but i already use that codes in the computation but it has no effect on the program..

What is this compute you using at 48 and 55th line??
And where you printing your marks calculated ??
If im not wrong you not initialized grade and still using for calculation, you 'll get garbage values

yes..but i also initialized grade?

You try to enter float type data, into integer variables -- that won't work.

Change your data type to float or double, for everything that handles anything with a decimal point, and your computations should improve a lot. ;)

A big hint for troubleshooting programs like this:

You have a LOT of data to be input for each run of the program. That's a real slow-down, when you need to run the program several times, to fix bugs that remain.

To speed it up HUGELY, just // the left side of the scanf() lines of code, and add an assignment line with a typical value, instead. Not:

scanf("%f", &someFloatvariable);

//but

//scanf("%f", &someFloatvariable);
someFloatVariable = 88.15;

Now you can troubleshoot MUCH faster. ;)

You'll need to cut out the assignment line of code, later on, but in the meantime, you can really scoot on your troubleshooting.

See i dont think there are any problems till 34th line ..
Now tell me how you going to calculate grades using those values mathematically than only i can help you to code it..

exam=((prelim+midterm+semifinals+finals)/4)*.6
classstanding=(quizzes*.05)+(assignments*.15)+(project*.15)+(attendance*.5)
total=exam+classstanding

Change datatype of exam, classtanding and total to float as they will hold decimal digits ..

float exam,classtanding,total;

/* Use your code to scan the data, What you wrote in above prog is correct itseems */
/* do calculation */

exams = ((prelim+midterm+semifinals+finals)/4)* 0.6;
classstanding = (quizzes*.05)+(assignments*.15)+(project*.15)+(attendance*.5);
total=exam+classstanding ;

/* print your results */
printf(" Total = %f",total);

Hope its clear..
If not ask your doubts

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.