+ 3

Fruit bowl approach

I m not getting any error but can you guys tell more merhods Check: #include <iostream> using namespace std; int main() { int fruit , result ; //take input cin>>fruit; result = fruit/6 ; cout <<""<<result; return 0; }

18th Sep 2020, 11:41 AM
Mantu kumar
Mantu kumar - avatar
7 ответов
+ 2
Yes result will give same but its depend on your think how much efficient and easy you can make your code in less lines
18th Sep 2020, 12:01 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 4
🗡️Jasprit ya, You are right! Snehal made a shorter and efficient code than suggested by you 🙂
18th Sep 2020, 12:04 PM
Namit Jain
Namit Jain - avatar
+ 3
🗡️Jasprit ,Namit Jain thanks for explaining. Can u guys help me out with hovercraft prblm https://www.sololearn.com/discuss/2503846/?ref=app
18th Sep 2020, 12:16 PM
Mantu kumar
Mantu kumar - avatar
+ 2
Snehal why do you want more methods if this method works And this is best possible method Ok, Instead of declaring a new variable Just do fruit /= 6; How do you know that everyone is using (fruit/2)/3 ? I used fruit/6 only Now, move on and try out more code coach 🙌
18th Sep 2020, 11:56 AM
Namit Jain
Namit Jain - avatar
+ 2
🗡️Jasprit there's no harm in using short cuts Both methods give same output so why do we need to make it lengthier
18th Sep 2020, 11:57 AM
Namit Jain
Namit Jain - avatar
+ 1
But why everyone is using "(Fruit/2)/3 " If " fruit/6 " did same for all the inputs
18th Sep 2020, 11:53 AM
Mantu kumar
Mantu kumar - avatar
+ 1
Read question properly
18th Sep 2020, 11:55 AM
A S Raghuvanshi
A S Raghuvanshi - avatar