CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// author : RubayetAlam
// post ID : 2318255
// https://www.sololearn.com/Discuss/2318255/?ref=app
#include <iostream>
using namespace std;
int main()
{
float price;
cout << "Enter the price" << endl;
cin >> price;
float list[3];
float sum = 0.0f;
for(int i = 0; i < sizeof(list) / sizeof(list[0]); i++)
{
list[i] = price;
cout << "entry: " << list[i] << endl;
sum += price;
}
cout << "sum: " << sum << endl;
return 0;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run