I am having trouble picking which variables need manipulating to produce the average mark.All the rest of the code works as desired.I would gratelly appreciate any help you can give.
Here's what I have to date:
// Lab 4 Prob 1 Student mark with average
// Author c infant
// Date last modified 20/11/10 19:26
// include header files
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
main () // main function heading
{
// declare variables
float average;
int numb=0,sum=0;
int counter=1;
int asgninit=0,asgnfinal=0;
int a1=0;
printf("Enter student number:"); //enter student number and scan for input
scanf("%d",&numb);
printf("Enter initial assignment number:"); //enter assignment number parameters and scan for input
scanf("%d",&asgninit);
printf("Enter final assignment number:");
scanf("%d",&asgnfinal);
// assignment and grade heading
printf("\n\nAssignment number\tMark out of 20\n============================================\n");
for (counter=asgninit;counter<=asgnfinal;counter++) // for loop conditions
{
printf("%.1d\t\t\t\t",counter);
scanf("%d",&a1);
if(a1>=0 && a1<=20); // conditions of validity
else printf("Please note marks are between 0 & 20\n"),system("PAUSE");
} // end loop
sum+=a1;
average=sum/; // calculate average and display answer
printf("Average mark:%d\n",average);
system("PAUSE"); // Pause to view result
} // End program

New Topic/Question
Reply




MultiQuote




|