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:-/

4
Contributors
4
Replies
6
Views
10 Years
Discussion Span

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

``````Input number of students

Loop while a counter is less then students
{
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!

Niek

thanks..i cud solve it....

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.