SCHOOL OF CODE BUILDERS
Learn To CODE. Become A DEVELOPER.
Pages
HOME
DATA STRUCTURES
STRINGS
ARRAYS
MATRIX
BINARY TREES
LINKED LIST
STACK
QUEUE
SORTING
SEARCHING
C
PYTHON
PSEUDOCODE
CONTEST PROBLEMS
ALGORITHMS
PATTERNS
PHP
C PUZZLES
C INTERVIEW QUESTIONS
JAVA
C++
HASHING
RECURSION
BASIC C PROGRAMS
TCS-CODEVITA
FACEBOOK
CONTACT US
C program to calculate average of marks
C program to calculate average of marks
Output:
Enter the number of subjects:
5
Enter the marks of each subject:
90 90 90 90 90
Average = 90.000000
Implementation:
#include
int main(void) { int n,marks,i,sum=0; float average; printf("Enter the number of subjects:\n"); scanf("%d",&n); printf("Enter the marks of each subject:\n"); for(i=1;i<=n;i++) { scanf("%d",&marks); sum += marks; } average = (float)sum / (float)n; printf("Average = %f",average); return 0; }
PREVIOUS
NEXT
HOME