0

When we want to add 5 numbers which are entered by the user then why we use the variable num

please

4th May 2017, 9:15 AM
Yogesh Yadav
Yogesh Yadav - avatar
2 Respostas
+ 16
You can use any variable name
4th May 2017, 9:16 AM
Shamima Yasmin
Shamima Yasmin - avatar
+ 7
double input,num; for(int x =0;x<5;x++){ cin >> input; num = num + input; } cout<<num; num could be anything... This is needed to temporarily store addition of all the numbers , one by one ,via a loop, in a variable Hope that makes sense.
4th May 2017, 9:20 AM
Meharban Singh
Meharban Singh - avatar