0

And what's wrong with it

#include <iostream> using namespace std; int main() { int b,c; cin >> b>>c; int a=(b/c)*100; cout <<a; return 0; }

27th Feb 2017, 5:45 PM
Collder
7 Answers
+ 2
Because 3/4 or 80/100 will return 0 here, write float a to get value.
27th Feb 2017, 5:59 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
+ 2
reply fast if you are still strucked somewhere. .I have to sleep :p
27th Feb 2017, 6:07 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
+ 1
you want to multiply 100 with c or with b/c. use bracket properly..like b/(c*100) or (b/c)*100
27th Feb 2017, 5:48 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
+ 1
what b and c value you entered?
27th Feb 2017, 5:54 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
+ 1
for example 3 4 or 80 100
27th Feb 2017, 5:57 PM
Collder
0
but it still doesn't work
27th Feb 2017, 5:52 PM
Collder
0
could you explain it or write the code with this float command
27th Feb 2017, 7:41 PM
Collder