New course! Every coder should learn Generative AI!
Try a free lesson+ 4
C++
You are a cook in a restaurant. You need exactly 3 crabs to cook your special seafood dish named "Trio". Write a program that will take the number of crabs as input and output how many "Trio" dishes can be made. Sample Input 14 Sample Output 4 I need help with this
47 Answers
+ 13
If u really need help
Show your attempt First
+ 10
demilade take the C++ course on sololearn and start learning yourself. If you have any doubts, ask in the discussion forum.
I see you haven't started any courses. Go to "learn" section and choose a language. Choose C++ if you wanna learn about the code in this discussion thread
+ 9
U have learn besic
+ 6
...our code works fine.
I see no issue with showing something as simple as (divide by 3)!
How else can you help with something as simple?
Rather than slamming us for providing the very basic template for a cpp program, maybe suggest OP should start the CPP basic course from scratch?
+ 5
#include<iostream>
using namespace std;
int main()
{
int crabs,dish;
cin >> crabs;
dish = crabs / 3;
cout<<dish;
return 0;
}
Simple one. The dish needs exactly 3 crabs. So we need to find how many dishes can be made using the given input. This is obtained by dividing the number of crabs by 3.
Use the SoloLearn's C++ course for solving these type of questions.
+ 4
#include <iostream>
using namespace std;
int main() {
int crabs;
std::cin >> crabs;
std::cout << "You can make " << crabs / 3 << " Seafood Trio's" << endl << endl;
if (crabs % 3)
{
cout << "With " << crabs % 3 << " crab(s) left over!";
}
return 0;
}
+ 4
This is a c++ question
+ 4
Oh ok
+ 4
python
x=int(input())
Print(x%3)
+ 3
I don't know C++
+ 3
/* If you divide an Integer number by an integer then it will result an integer with ceil value
Code :- */
#include<iostream>
using namespace std;
int main (){
int crab;
cin>>crab;
cout<<crab/3;
return 0;
}
+ 3
Think whole number division
+ 3
Florida Miami (Floridan)
*Get the number of crabs "n" as input.
*Calculate the integer division of n/3(stored as m), ignoring any remainders or decimal numbers.
*Output m.
+ 2
HrCoder didn't see that he uploaded his code
+ 2
#include <iostream>
using namespace std;
int main()
{
int crabs;
cin >> crabs;
int s = crabs / 3;
cout << s << endl;
return 0;
}
+ 2
#include<isotream>
namespace std;
int main()
{
Int crabs;
Cin>>crabs;
Cout<<"x";
Cout<<"y";
}
+ 2
int num;
cin >> num ;
int trio = num / 3 ;
cout << trio ;
+ 2
Look at the C++ tutorial on how to do input and output.
+ 2
I don't know C ++ but I will know C language 💬 -- the print("hello world! "); will almost used in the C program...
+ 2
Next time first share your code also so others can analyse your problem.
#include <iostream>
using namespace std;
int main()
{
int crabs;
cin >> crabs;
int s = crabs / 3;
cout <<s << endl;
return 0;
}