Do the following for the user-entered number of students.
Find the average marks for a student of his marks in 3 subjects. Print whether he
passed or failed. A student will fail if his average is less than 50. Use for loop...can u help me writing this pgm.....thankss:-/

To give you an example of how this problem could be solved:

Input number of students

Loop while a counter is less then students
    input grade1
    input grade2
    input grade3
    average = (grade1 + grade2 + grade3) / 3
    if average < 50
        print "you've failed!"

And here's an example of a for-loop:

for (int i =0;i<10;i++)
    printf("%d\n", i);

This will show the numbers 0-9.

So now you can start translating this to C. Come back with questions if you get stuck!


For what exactly is this for loop being used?What does it do?Does is take in the marks or does it restrict the number of students to 10?

The for loop restricts the number of students being assigned marks. It could restrict it to 0, or to 20000, (or more), depending on what the user input as his/her choice.