Time limit exceeded
I made a calculator program in C, but it said time limit exceeded when running it. Please help me to increase the time limit
More than likely your time usage is due to a bug. If you link your code here, we might find it so your program works.
you cannot increase the time limit. sololearn sends the code to their server,its run there and output is returned back to codeplayground. this means your code has a limited runtime
getch is what is causing your issue. It is a non-standard function so is hanging your program. Use the standard equivalent: getchar. To enter in Playground, run with: 5 6*
Harsh I have rectified your all errors and made it working here.Input pattern is changed as it was the bug,so check the C-comments section inside the program for more details .Program logic remains same.No change to your program logic.Check the link given far below to the program for further details. The program explains in details for each step reporting errors and the correction made against it in form of C-comments. Run the program and execute it to get the output. The main cause or bug of your program not working here is precedence order to read input from user. Check the program below for detailed explanation and a suggestion from my side would be read the C-comments in code section of the program along with C-Comment section for detail understanding. Hope it clarifies your doubt. The link to the program is given below here, feel free to look:- https://code.sololearn.com/cxC13o2OL6r7/?ref=app
One of the reason can be program goes in an infinte loop.
my program runs in android dosbox
Usually this happens is because of an infinite loop. It takes a lot for a normal program to take 5 seconds to compile and run
I'd have stuck with scanf()... More importantly, you need to handle if x is not +, -, /, or *. Most would suggest a case default, but may I suggest a while statement, eg: char x = 0; ... while (x != '-' && x != '+' && x != '*' && x != '/') scanf("%c", &x); /* or x = getchar() if you prefer */ Just makes life easier to avoid invalid input. Although you should usually have a default case. You also need to format your code or you'll lose track of it. It's not very legible. Anyway, good luck!
I made a program for pattern and it is not running and say time exceeded
Why are my users being logged as [object Object] when logging my array/user instead of giving me the values [name, age]?
JS in sololear is latest version or older? What do we use often VAR or LET and CONST?? I Have VAR is no longer used is it true??
Как сравнивать строки в Phyton?
Kotlin get if Var doesn't exist
Sololearn bug @mentors