+ 2
How can i calculate d sum of array??
for eg i wll take 11 subject of marks int m[11] then i has to calculate d percentage so what can i do?
7 odpowiedzi
+ 4
logic after getting marks of user :
for(int i = 0;i<11;i++)
{
sum = sum + marks[i];
}
+ 4
it will go long. you have to add all elements.
like this
sum = mark[0] + mark[1] + mark[2] + mark[3] + mark[4] + mark[5] + mark[6] + mark[7] + mark[8] + mark[9] + mark[10]
+ 1
int sum =0;
for (int i=0;i<m.length; i++){
sum +=m[i];
}
0
Raj Chhatrala can i get sum without using loop???
0
T0nd3 can i dont use without using loop
0
ohhhhh
BTW thnxxxx Raj Chhatrala
0
Raj Chhatrala if u want to accept m[11] then what can i do??? n where i put 11 subject of marks???