Number of Passed Student C Program

How to write a c program to find the number of passed students passed by entering the marks of student input by the user in C programming ?


Solution:
#include <stdio.h>

int main()
{
    int n, passed, i, number;

    printf("How many students?\n");
    scanf("%d", &n);

    passed = 0;
    for(i = 1; i <= n; i++)
    {
        printf("Enter marks of student %d: ", i);
        scanf("%d", &number);
        if(number > 33)
            passed++;
    }

    printf("%d students passed among %d\n", passed, n);
}


Learn More :