Weather Report

Santu is a newcomer in Rangpur. He is having trouble adjusting with the strange weather of Rangpur. …

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

#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

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

what’s wrong with my CODE??

@hjr265 bhaiya, Please let me know when the weather will be confusing. the explaination is not clear

1 Like

Thanks for pinging me. I didn’t realize this is what the problem was about; not something I am particularly fond of.