+ 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
17 Antworten
+ 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;
}
+ 10
Amaan Khan u have to share ur attempt first
+ 10
Amaan Khan it's code coach links
U have to share ur code link seperately
+ 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.👍
+ 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;
}
+ 5
Solved
+ 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.
+ 3
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥
Ohhh man !!!!😄
Sorry for the inconvenience you faced to understand the question. But yes I want a solution too.
+ 3
Jay Matthews then would you please figure out the problems in my code or would you please share your code.
+ 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.
+ 2
What might be the other three test cases?
+ 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.
+ 1
The question itself is wrong and I was trying again and again thinking that I have to round off the answer 😒