+ 1

can anyone say where am I wrong

https://prnt.sc/1ys5dzk https://prnt.sc/1ys5jq3 https://prnt.sc/1ys5lod https://prnt.sc/1ys5ny7 it's expecting output as 10588 but I am getting my output as 10587

8th Nov 2021, 4:17 PM
morgan
morgan - avatar
9 Answers
+ 4
121* 175= 10,587.5 Since you’re printing the result as an int it just cuts off the .5 and gives you 10,587
8th Nov 2021, 4:46 PM
Jocelyn
Jocelyn - avatar
+ 2
Instead of screen shot, copy to code playground your code and description and save. Share link here. Those are not clear enough to identify problem.
8th Nov 2021, 4:22 PM
Jayakrishna 🇼🇳
+ 2
https://code.sololearn.com/cRnKyuJE3bb2 and then take input as 121 175 the output it's expecting is 10588 but I am getting output like 10587
8th Nov 2021, 4:28 PM
morgan
morgan - avatar
+ 2
Try this: printf("%d",(int)ceil(m*n/2.0)); it rounds up the value... cast back to int
8th Nov 2021, 4:46 PM
Jayakrishna 🇼🇳
+ 1
description: A Person want to know the minimum number of tiles required to cover his floor and the size of tiles are 2*1 and the input is the length of a floor is the input
8th Nov 2021, 4:36 PM
morgan
morgan - avatar
+ 1
Thank you soo much
8th Nov 2021, 4:52 PM
morgan
morgan - avatar
0
If you want to see your mistake well and Get the expected Value recommend at first.. Make all your Variables float points 😊
8th Nov 2021, 9:16 PM
Nasry Mansour
Nasry Mansour - avatar
0
It looks like it was answered so let's look at what happens. int a = 9; int b = 2; int c = a / b;. // Should be 4.5 but it's drop the digits to the right of the decimal so 4 However because int is a smaller type than float or double it will auto promote to the highest. int a = 9; float b = 2.0; float c = a / b; this will produce 4.5 even though a is of type int. If we use int a = 9; float b = 2.0; Int c = a / b; //if you get lucky enough not to get a casting error will produce 4 again due to c being of type int.
9th Nov 2021, 2:32 AM
William Owens
William Owens - avatar
0
I got your point but it's given in question that it should be taken int a,b ;
9th Nov 2021, 2:43 AM
morgan
morgan - avatar