+ 1
17th Oct 2020, 3:53 PM
BALAKUMAR N
BALAKUMAR N - avatar
3 Answers
+ 3
#include <iostream> // including input and output library using namespace std; // including std namespace int main() { int num = 1; int number; int total = 0; while (num <= 5) { // will be repeated 5 times, because the num variable gets increased every iteration cin >> number; // input number total += number; // add the number to the total variable num++; // increase the num variable } cout << total << endl; // output total return 0; // end of main function. } Basically this code finds sum of 5 numbers you enter.
17th Oct 2020, 4:04 PM
Artem 🇺🇦
Artem 🇺🇦 - avatar
+ 1
Alphin K Sajan, You're wrong. Not number multiplied by 5, but sum of 5 numbers you enter. Input: 1 2 3 4 5 Output: 15.
17th Oct 2020, 4:06 PM
Artem 🇺🇦
Artem 🇺🇦 - avatar
+ 1
This code gets 5 integer inputs from user and give sum of them.
17th Oct 2020, 4:41 PM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar