Friday, October 30, 2009

Average and percentage 5[F]c

Write a function that receives marks received by a student in 3 subjects and returns the average and percentage of these marks. Call this function from main( ) and print the results in main( ).

void main()
{
int a,b,c,full;
float av,perc;
printf("\nEnter the marks received by the student in 3 subjects and the total possible marks for 1 paper");
scanf("%d%d%d%d",&a,&b,&c,&full);
calc(a,b,c,full,&av,&perc);
printf("\nThe average marks is %f.\nThe percentage is %f",av,perc);
}

calc(int i,int j,int k,int full,float *ave,float *perce)
{
*ave=(i+j+k)/3.0;
*perce=(*ave/full)*100.0;
}

2 comments:

  1. I cannot thank Mr Benjamin service enough and letting people know how grateful I am for all the assistance that you and your team staff have provided and I look forward to recommending friends and family should they need financial advice or assistance @ 1,9% Rate for Business Loan .Via Contact : .  247officedept@gmail.com. WhatsApp...+ 19893943740. Keep up the great work.
    Thanks, Busarakham.

    ReplyDelete