in my compiler , i’m getting absolute correct answer but here getting wrong answer.why??
Your code is probably failing for a few corner cases. You should test your code to check for the corner cases as well. So, check for lots of Test Cases.
Also, don’t forget to print newlines at proper places. Your output should match the format of the output in the problem statement. If you miss a newline, that’s enough to get a Wrong Answer
You should not add any unnecessary things like " Enter a number " , " the answer is ". Those will also get you WA. So, don’t add any unnecessary statements like that.