0
How do I find the smallest element from the array declared?
I need to find the smallest array element so that i can calculate discount. https://photos.app.goo.gl/J29PgowokHGftTHW7 The code is like this: { int arr[7]; for (i = 0; i < 7; i++) { cin >> arr[i]; } //code here return 0; } so you are required to input numbers and find the smallest out of the number.
5 ответов
+ 1
See my answer for possible approaches in a different thread:
https://www.sololearn.com/discuss/2820658/?ref=app
+ 1
Show your attempt at a solution.
+ 1
To solve this problem, you need to repeat the lessons on conditional branching if ... else ... and think a little about how to use it in a loop.
+ 1
I did solve the problem but thanks alot for your support
0
The code is like this:
{
int arr[5];
for (i = 0; i < 5; i++) {
cin >> arr[i];
}
//code here
so now how do you calculate which of the five element input is the least?