0

what's the wrong with this code ?? ..it doesn't make the prossecc
just typing the marks then nothing !!

//program to get degrees of ten students in exam and compute the average exam degree of them

#include<iostream>
using namespace std;
int main()
{
  int mark,i;
  int average,sum=0;
  cout<<"enter 10 marks :";
  for(i=0;i<=10;i++)
    {
     cin>>mark;
     sum+=mark
    }
  average=sum/i;
  cout<<"average = "<<average<<endl;
  return 0;
}  
3
Contributors
4
Replies
18
Views
3 Years
Discussion Span
Last Post by rose_2
0

You've missed a semi-colon on line 11.
Your for loop will go round 11 times instead of 10.
Other than that, nothing. If you enter 11 marks you'll get an average mark. What makes you think it doesn't work?

Edited by Moschops

0

oh the semi-colon wasnt missed in my compiler i typed it .. but may be the reason in my loop ..i forgot that we include 0 while counting .. thxx

is there another way to write this program ??

0

ahaa .. i got it and fixed theat error .. thaaanks so much

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.