Have anyone solved it ????? | Sololearn: Learn to code for FREE!

+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

6/3/2020 10:43:53 AM

Amaan Khan

18 Answers

New Answer

+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

+6

Amaan Khan Mention that you also want a solution in your question & you won't be provided Complete Code without making any attempt as suggested byAKR

+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

+5

Amaan Khan No one is able to see your code in code coach so it will be better if you save it in code playground and link it here

+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

+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 πŸ˜’