0
Basic arithmetic , need help!
I need help with the division problem with decimals!
9 ответов
+ 2
#include <iostream>
using namespace std;
int main() {
int crabs,x;
int dish=3;
cin >> crabs;
//your code goes here
x = crabs / dish ;
cout << x;
return 0;
}
You don't need to take input for dish.In problem, it say how many trio can be made ,trio means 3
We need to do is to divide input(crabs) by 3.
And you we don't need to use double data type,if do, it will print output in decimal points
, just use integer data type
+ 1
Its division with decimals
#include <iostream>
using namespace std;
int main() {
double crabs , dish , x ;
cin >> crabs;
cin >> dish;
double x = crabs / dish ;
cout << x;
return 0;
}
+ 1
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
+ 1
Myo Thuzar
Thanks im new and been strugguling
0
You don't need input for that <dish>. It's a fixed value of 3. So don't read input for <dish> instead assign <dish> value as <dish> was defined.
0
Marcel don't worry,we all once were beginners
0
Myo Thuzar
Would you mind expalaing somethimg to me?
Ive been struggling to find a good explanation for what a framework is , ive look at a lot of vids but just cant get it … sooo could you explain it to someone who litteraly know zero about it , please
0
Marcel man
I saw you posted question about framework
in your next question and someone commented under your post.
It is better to read that threads
- 1
#include <iostream>
using namespace std;
int main() {
int crabs,dishes,crabs_per_dish = 3;
cin >> crabs;
//your code goes here
dishes = crabs/crabs_per_dish;
cout << dishes;
return 0;
}