array : array is a group of elements of same data types. single dimensional array. this program will accepts 5 students marks and store them into an array m and then it will total them. array always start with 0. means first element always be 0.
#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
int m[5];
int tot=0;
for (int i=0;i<=4;i++)
{
cout <<"enter any marks";
cin >> m[i];
tot = tot + m[i];
}
cout << tot <<endl;
cout << tot/5 <<endl;
getch();
}
No comments:
Post a Comment