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.

11th Jul 2021, 8:36 AM
Mohammed Ramadhan
Mohammed Ramadhan - avatar
5 ответов
+ 1
See my answer for possible approaches in a different thread: https://www.sololearn.com/discuss/2820658/?ref=app
11th Jul 2021, 9:31 AM
Shadow
Shadow - avatar
+ 1
Show your attempt at a solution.
11th Jul 2021, 9:32 AM
Solo
Solo - avatar
+ 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.
14th Jul 2021, 7:51 AM
Solo
Solo - avatar
+ 1
I did solve the problem but thanks alot for your support
14th Jul 2021, 9:23 PM
Mohammed Ramadhan
Mohammed Ramadhan - avatar
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?
14th Jul 2021, 4:00 AM
Mohammed Ramadhan
Mohammed Ramadhan - avatar