Weather Report

Santu is a newcomer in Rangpur. He could not adjust to the strange weather in Rangpur. He goes out for various tasks. But most of the time, it starts raining and he has to come home drenched. He wants you to write a program for him to get rid of this problem. Now you write a program that reports a certain day’s weather to Santu.


This is a companion discussion topic for the original entry at https://toph.co/p/weather-report

#include <stdio.h>
int main()
{
int prob;
scanf("%d",&prob);
if(prob>=70&&prob<=100)
{
printf(“Bad weather.”);
}
else if(prob>=0&&prob<=30)
{
printf(“Good weather.”);
}
else if(prob>=31&&prob<=69)
{
printf(“Confusing weather.”);
}
return 0;
}

//What is the problem with this code//

Check your quotation mark use " in printf

I corrected the quotations
But still it shows incorrect answer at case 9
Could you please specify??

@Sarwat.33 Read output carefully

include <stdio.h>

int main (void)
{
int P;

scanf("%d",&P);

if (P>=70 && P<=100 && P>=0) printf("Bad weather.\n");

else if (P<=30 && P<=100 && P>=0) printf ("Good weather.\n");

else  if (P<70 && P>30 && P<=100 && P>=0) printf("“Confusing weather.”");

}

This program fails in the 11th test case. I dont understand whats wrong here. Can anybody point out my mistake?

@hjr265 bhaiya, please change the quotation marks to " from , if it isn’t something solvers are supposed to fix on their own.

1 Like

@anonyo.akand Looks like a bug in how we render Markdown. I will apply a fix for this tonight in sha Allah.

1 Like

@hjr265 Yes bhaiya, it could be that. I’ve noticed this problem in some other problems too.
Thanks for your attention!

1 Like

@hjr265 Thanks again for the fix! Looks perfect now.

My code also showed “Wrong answer” on 11th testcase. When I changed (cout << “confusing…”) to (cout << “\“confusing…\””), it worked. I think the question should be updated.

try this one “Confusing weather.” i think its a mistake. worst test case