C program 1-D array

Write a function to count how many students get marks higher than the average and how many students get marks lower than average mark out of n number of students.

Showing Answers 1 - 3 of 3 Answers

elayaraja.v

  • Dec 16th, 2014
 

Write a function to count how many students get marks higher than the average and how many students get marks lower than average mark out of n number of students.?

Code
  1. #define AVG 60

  2. void count(int no_of_students){

  3. int i, marks,la,ga;

  4. for(i=la=ga=0;i<=no_of_students;i++,(marks<AVG)?la++ : ga++;){

  5. printf("please enter studentd   %d   Marks  :

  6. ",i);

  7. scanf("%d",&marks);

  8. }

  9. printf("  less than average    %d

  10. grater than average  %d

  11. ",la,ga);

  12. }

  13. main(){

  14. int n;

  15. printf("Please enter how many students appered for exam:  

  16. ");

  17. scanf("%d",n);

  18. count(n);

  19. }

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions