Answer to Question #215989 in C for Hemambar

Question #215989
Write a c program to calculate the average marks scored by the students in each subject using function
1
Expert's answer
2021-07-15T02:45:35-0400
#include<stdio.h>
double average(int firstMark, int secondMark, int thirdMark){
	return (firstMark + secondMark + thirdMark) / 3;
}
int main(){
	int firstMark;
	 int secondMark;
	  int thirdMark;
	  printf("Enter the first mark\n");
		scanf("%d", &firstMark);
		
		printf("Enter the second mark\n");
		scanf("%d", &secondMark);
		printf("Enter the third mark\n");
		scanf("%d", &thirdMark);
		printf("\nThe average of %d, %d, and %d is %f",firstMark, secondMark,thirdMark, average(firstMark, secondMark,thirdMark));
		
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS