# C Program to find Average marks of 30 students

In this article, we will be writing a C Program to find average marks of 30 students. We will first write the algorithm for it and then we will continue writing the C program. The concept of C program is very clear, we need to find the average marks of a group of 30 students.

It is very simple to find average of something, we need to use the mathematical formula to find average marks of 30 students in C Program.

The formula is very simple: sum of all occurrences/number of occurrences

## 1. Program Outline

In this program, we need to input the total marks of 30 students in C Program. We can use the scanf() function to take the input. After taking input we need to calculate the sum of all the input numbers of 30 students.

Following the sum of input marks, we need to divide it by 30 to find the average marks of 30 students.

## 2. Concepts

In writing this C Program to find Average marks of 30 students, we need to use the following programming concepts:

1. scanf() function: We will use scanf() function to input marks of 30 students
2. while loop: while loop is used with input function to input marks of all 30 students
3. Arithmetic Operators: We will use Arithmetic operators to find average marks of 30 students
4. printf(): printf() function will be used to give us output of program in Terminal

## 3. Algorithm

Before writing the C Program to find average marks of 30 students, we need to write the Algorithm first.

```Step 1: START
Step 2: input marks of 30 students
Step 3: loop up to 30
Step 4: Sum marks of all the 30 students
Step 5: Divide the sum by 30 and store it in the average variable
Step 6: Output average
Step 7: STOP```

## 4. Program

Let’s write C Program to find Average marks of 30 students. Here it is:

``````#include <stdio.h>

int main()
{
int studentCount=0, marksSum=0, average=0, inputMarks;
printf("Enter the marks of 30 students:");
while(studentCount<30)
{
scanf("%d", &inputMarks);
marksSum += inputMarks;
studentCount += 1;
}
average = marksSum / 30;
printf("Average Marks: %d", average);
}``````

## 5. Output

After writing compile and run the program with your preferred compiler. We use ming-w compiler. Let’s have a look at the output of programs: