somebody please help me to correct this coding program

#include <stdio.h>
void readmarks (int* num1,int* num2,int* num3);
void grademarks (int num1,int num2,int num3,int* num4,int* num5,char* grade);
void printmarks(char grade);

int main ( void)

{
  
  int num1;
  int num2;
  int num3;
  int num4;
  int num5;
  char grade;

readmarks (&num1,&num2,&num3);
grademarks (num1,num2,num3,&num4,&num5,&grade);
printmarks (grade);



  return 0;
}


void readmarks (int* num1,int* num2,int* num3)

{
  
  printf("Please enter your 1st test mark:\n");
  scanf ("%d",num1);

  if(*num1>100)
	  printf("\aError\n");
  printf("Please enter your 2nd test mark:\n");
  scanf("%d",num2);
  if (*num2>100)
      printf("\aError\n");

  printf("Please enter your 3rd test mark:\n");
  scanf("%d",num3);
  if (*num3>100)
      printf("\aError\n");

return ;

}

void grademarks (int num1,int num2,int num3,int* num4,int* num5,char* grade)

{
*num4=(num1+num2+num3)/3;
  
*num5=(num3+num2)/2;

  if(*num4>=90)
	 *grade='A';

  if(*num4>=70,*num4<90)
	  if(num3>90)
		  *grade='A';
	  else
		  *grade='B';
   if(*num4>=50,*num4<=70)
	   if(*num5>70)
		   *grade='C';
	   else
		   *grade='D';
	   if(*num4<50)
		   *grade='F';

	   return ;

}
void printmarks(char grade)
{

printf("your grade is %c\n",grade);

return;
}

Recommended Answers

All 4 Replies

What's the problem, besides it being C in a C++ forum? And your not enclosing the code in code tage.

Can you elaborate on your problem.
Given the subject of your post,
I thought you had problems opening a file in your code.
But it seems there are no file input/output.

Can you compile the code, and if you can't compile what is the error message.

moved

if(*num4>=70 && *num4<90) {
        if(num3>90)
            *grade='A';
        else
            *grade='B';
    }
    if(*num4>=50 && *num4<=70) {
        if(*num5>70)
            *grade='C';
        else
            *grade='D';
    }

Substitute the (,) for what's in red.

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.