+ 5

How to get 5 numbers from user using for loop and print their sum ?

25th Jun 2018, 12:33 AM
Abdul Shakoor Mousa
Abdul Shakoor Mousa - avatar
4 Respuestas
25th Jun 2018, 12:53 AM
qwerty
qwerty - avatar
25th Jun 2018, 7:30 AM
Shahil Ahmed
Shahil Ahmed - avatar
+ 1
int num; //input int sum= 0; //get the total here for (int i= 1; i<= 5; i++){ cin>> num; sum+= num; } cout<<"Total= "<<sum; return 0;
25th Jun 2018, 3:06 AM
ADIL GAAFER
ADIL GAAFER - avatar
25th Jun 2018, 3:09 AM
ADIL GAAFER
ADIL GAAFER - avatar