GoConqr has a new look! Let us know what you think.

Notes

Lab6_ex4

iamcararaes English 1 page

Content of the notes (1)

Page 1

#include void main() { int count=0; float mark,sum=0,average=0; char name[10]; char grade; while(1) { printf("Please enter name :"); scanf("%s",&name); printf("Please enter test marks, -9999 to exit :"); scanf("%f",&mark); if (mark != -9999) { sum = sum + mark; count++; if (mark >= 80) { grade = 'A'; } else if (mark >= 70) { grade = 'B'; } else if (mark >= 60) { grade = 'C'; } else if (mark >= 50) { grade = 'D'; } else { grade = 'F'; } printf("Name\t Marks\t Grade\n"); printf("%s\t %.2f\t %c\n",name,mark,grade); } else { break; } } if (count != 0) { average = sum/count; printf("\n\n%d of student enter their test results.\n",count); printf("The average of their marks is %.2f\n",average); } else { } }

New Page

Information

Description
Note on Lab6_ex4, created by iamcararaes on 02/06/2014.
Created by
iamcararaes · Jun 2014
Updated
Feb 19, 2016
Views
37
Rating

More on Conditionals and Loops

Feedback

What is it about?

What do you think of the new look?

How do you like it?