- 2

What's the purpose of that "int total= 0;"?

9th Sep 2016, 4:47 PM
Joyce Paras
14 Respostas
+ 3
declare a total variable of type int to store total value
22nd Sep 2016, 4:51 AM
Sudhir Katiyar
Sudhir Katiyar - avatar
+ 2
It declares and initializes the integer variable total to 0.
14th Sep 2016, 10:54 AM
Zen
Zen - avatar
0
it initialise total with 0 value and when all operations are done we get new value .. we always need starting point .. in this case 0 is the starting point for "total".
11th Sep 2016, 7:53 PM
Bhushan Gaikwad
Bhushan Gaikwad - avatar
0
it initializes the total to 0
17th Sep 2016, 1:13 AM
Lumunye Hisham
Lumunye Hisham - avatar
0
To declare and initalise total.
18th Sep 2016, 8:47 AM
aman kumar
aman kumar - avatar
0
Standard initialization
2nd Oct 2016, 12:02 PM
Hjalmar
Hjalmar - avatar
- 2
"total += x;" increments the variable total by the value of x.
9th Sep 2016, 5:32 PM
Zen
Zen - avatar
- 2
so what's its output then?
9th Sep 2016, 6:03 PM
Joyce Paras
- 2
ohhhh, okay thank you 😊
10th Sep 2016, 12:29 AM
Joyce Paras
- 2
"total += x;" --> total = total + x
10th Sep 2016, 2:35 PM
Souf
Souf - avatar
- 3
how about that "total += x;"?
9th Sep 2016, 5:15 PM
Joyce Paras
- 3
same as total=total+x;
10th Sep 2016, 12:03 AM
Abdullahi Mukhtar
Abdullahi Mukhtar - avatar
- 3
the output is like the updated value of total
10th Sep 2016, 8:43 AM
Abdullahi Mukhtar
Abdullahi Mukhtar - avatar
- 3
in order to store the result of an expression into the total, first we have to intialize the value of total to zero.
11th Sep 2016, 4:20 AM
JAPA VINAY TEJA
JAPA VINAY TEJA - avatar