My issue
i have written the right code but still it is giving eroor
My code
#include <iostream>
using namespace std;
int main() {
int x;
int y;
int z;
cin>>x>>y>>z;;
int a = 5x+10y;
int b=a/z;
cout<<z<<endl;
// your code goes here
return 0;
}
Learning course: Basic Math using C++
Problem Link: CodeChef: Practical coding for everyone
Hey a couple of things:
You need to run the program t number of times (test cases) hence you need a while loop for that
Secondly, when we multiply in c++ we use “*” operator
also you need to print b i.e. a/z not z
here is the corrected code. Hope it helps
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int x;
int y;
int z;
cin>>x>>y>>z;;
int a = 5*x + 10*y;
int b=a/z;
cout<<b<<endl;
}
// your code goes here
return 0;
}