need sum help with a function please!!
OK, i am very new to programming as a whole infact i have only been doing it for a couple of months :) i am generally getting on ok with it,altho frustrating at time but i am stuck on something that i have to do for college. I have written a program that calculates two exam results and gives out a total mark and converts the total marks to a grade from A - F, however i have not put it into fuctions. i have tried and tried to separate my programme into functions but i cant seem to get it to work :( can anybody give me some assistance.
Code:
#include <stdio.h>
#include <conio.h>
int main(void)
{
int examMark;
int assignMark;
int totalMark;
char grade;
{
printf("\nEnter exam mark out of 50: ");
scanf("%d", &examMark);
printf("\nEnter assignment mark out of 50: ");
scanf("%d", &assignMark);
totalMark = examMark + assignMark;
if (totalMark >= 39)
{
if ((examMark <15) || (assignMark < 15))
{
totalMark = 39;
}
else
{
if (totalMark == 39)
{
totalMark = 40;
}
}
}
if (totalMark >=70)
{
grade = 'A';
}
else
{
if (totalMark >=60)
{
grade = 'B';
}
else
{
if (totalMark >= 50)
{
grade = 'C';
}
else
{
if (totalMark >= 40)
{
grade = 'D';
}
else
{
grade = 'F';
}
}
}
}
printf("\nExam : %d/50 Assignment : %d/50 Grade : %c\n\n", examMark, assignMark, grade);
}
return 0;
}
any help at all would be much appriciated, cheers james