[ad_1]
You add by using the += operator:
for (i = 1; i <= n; i++)
total += i;
cout << total;
Note this is short for total = total + i.
3
[ad_2]
solved for-Loop to add integers [closed]
[ad_1]
You add by using the += operator:
for (i = 1; i <= n; i++)
total += i;
cout << total;
Note this is short for total = total + i.
3
[ad_2]
solved for-Loop to add integers [closed]