BCS-1A

Friday, January 13, 2012

Student marks(while loop)


#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int n,
    i;
double sum,
       marks;
cout<<"Enter total number of Students :";
cin >>n;
i=1;
while(i<=n)
{
cout<<"Enter marks of Student "<<i<<":";
cin >>marks;
sum=sum+marks;
i++;          
}
cout<<"The sum is :"<<sum;
    getch();
    return 0;
}

No comments:

Post a Comment