When i run a program output shows "time limit exceeded" . What should I do? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

When i run a program output shows "time limit exceeded" . What should I do?

https://code.sololearn.com/cROH6Wp9h6ne/?ref=app

5th Jul 2018, 5:42 AM
Srivalle Sabani
3 Answers
+ 1
If you want to run it properly in sololearn playground, remove getch()
5th Jul 2018, 7:10 AM
Дмитро Іванов
Дмитро Іванов - avatar
0
It means that code is to be solved in much easier and shorter way. The compiler is programmed for that shorter code to be compiled, and as your code is taking long to compile and execute longer than time to be consumed, it is showing that alert.
5th Jul 2018, 5:51 AM
Abhishek Rawat
Abhishek Rawat - avatar
0
You can do it like this.. Or u can make it more efficient by printing all in one printf function.But thats not a good practise.. #include <stdio.h> int main(){ int a,b,answer; scanf("%d %d",&a,&b); printf("sum of %d + %d = %d\n",a,b,a+b); printf("sum of %d - %d = %d\n",a,b,a-b); printf("sum of %d * %d = %d\n",a,b,a*b); printf("sum of %d / %d = %d\n",a,b,a/b); return 0; }
5th Jul 2018, 6:16 AM
Mohammad nahid
Mohammad nahid - avatar