Have anyone solved it ????? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Have anyone solved it ?????

I have solved it in c. Two test cases out of five are tested right but remaining three test cases are coming wrong. I have tried too many modifications but problem remain same !!!!!! https://www.sololearn.com/coach/4?ref=app This is my code link👇 https://code.sololearn.com/c7iy9o1mSsPP/?ref=app

3rd Jun 2020, 10:43 AM
Amaan Khan
Amaan Khan - avatar
13 Answers
+ 3
Yes, I solved it. 👉👉👉The nearest whole number means the next whole no. in the problem #include <stdio.h> int main() { int houses,a,b; scanf("%d", &houses); //your code goes here a=200/houses; b=200%houses; if (b==0) printf("%d",a); else printf("%d",a+1); return 0; }
5th Jun 2020, 3:37 AM
UnknownX
UnknownX - avatar
+ 10
Amaan Khan u have to share ur attempt first
3rd Jun 2020, 11:12 AM
ÃKR
ÃKR - avatar
+ 10
Amaan Khan it's code coach links U have to share ur code link seperately
3rd Jun 2020, 11:17 AM
ÃKR
ÃKR - avatar
+ 6
AKR 𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 Ohhh!!! I see. You will be seeing your own code that you have coded at the time of solving. Okk i'm editing my question and adding my code link too.👍
3rd Jun 2020, 11:24 AM
Amaan Khan
Amaan Khan - avatar
+ 5
#include <stdio.h> int main () { int house; scanf ("%d", &house); getchar (); int dlr=200/house; if ((200%house*10)/house>=0 && 200%house!=0) dlr+=1; printf ("%d", dlr); return 0; }
4th Jun 2020, 8:38 AM
SAN
SAN - avatar
+ 5
Solved
4th Jun 2020, 8:38 AM
SAN
SAN - avatar
+ 4
ŚĄŃ it's working !!!!! But I literally didn't understand the condition you have put in the if statement. And one more thing if you put houses=6 in your code both conditions in the if statement will be true and the answer will be 34 while the answer 200/6= 33.33 should be the nearest integer of 33.33 which is 33. Can you please figure out the mistakes in my code too.
4th Jun 2020, 9:30 AM
Amaan Khan
Amaan Khan - avatar
+ 3
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 Ohhh man !!!!😄 Sorry for the inconvenience you faced to understand the question. But yes I want a solution too.
3rd Jun 2020, 11:10 AM
Amaan Khan
Amaan Khan - avatar
+ 3
Jay Matthews then would you please figure out the problems in my code or would you please share your code.
3rd Jun 2020, 11:13 AM
Amaan Khan
Amaan Khan - avatar
+ 3
AKR I have done it already👍 Click on the link in my question and for solving select the c language . You will find my attempt there.
3rd Jun 2020, 11:16 AM
Amaan Khan
Amaan Khan - avatar
+ 2
What might be the other three test cases?
4th Jun 2020, 4:47 PM
Danda Harshavardhan reddy
Danda Harshavardhan reddy - avatar
+ 2
Pretty easy in python: import math houses = int(input()) x=math.ceil(200/houses) print(x) But the thing is we need to print the next number not the nearest whole number. The question itself is wrong.
5th Jun 2020, 5:36 AM
Danda Harshavardhan reddy
Danda Harshavardhan reddy - avatar
+ 1
The question itself is wrong and I was trying again and again thinking that I have to round off the answer 😒
5th Jun 2020, 6:01 AM
Amaan Khan
Amaan Khan - avatar