int prefixsum(int i,int a)
int suffixsum(int i,int a,int n)
// your code goes here
cout<<"\n Enter no. of test cases";
cout<<“Enter the size of array”;
cout<<“Enter elements of array”;
Take a look at this link. In short you are using turbo C standards where as codechef IDE supports GCC.
In windows you can use mingw or on Linux you can use gcc to test your program.
The gcc standards and Turbo C standards are somewhat different which was your problem.
Here is why your program is not working.
#1 Use header files as #include etc. Or you can include bits/stdc++.h which is parent for all header files and you need not to include files again and again.
#2 Use std namespace to avoid naming collisions.
#3 Remove unnecessary functions such as clrscr(); and getch();
#4 Use int main() with return instead of void main() as it needs to return execution value i.e 0 for proper execution.
Here is the code
I prefer to use codechef official IDE
To make it compile, do this-
#include<conio.h>it isnt used anymore.
using namespace std;
- void main()\rightarrow int main()
- Remove functions of conio.h as well. Replace by their alternatives. Like clock() for clrscr() and getc() instead of getch() [Read their syntax]
- Remove those unnecessary print statements which will give you WA. Your output is matched for an exact match for expected output by machine, so those print statements are redundant and get WA
Plagiarism is a sin dear. You could have at least changed the ordering from mine. Please make sure not to copy off someone else’s answer. It can lead to your suspension
Bro I commented before you, when a question have similar error and we both noticed that errors doesn’t mean that i copied you.
Revision history is visible to all :). You added those points minutes after I posted my answer.
Anyways, it was just a warning.
I think you might be a school student and that’s why you use turbo c++. You should use GNU C++ to be able to submit in any online judge as Borland has stopped supporting turbo since 2002. A good resource to learn about the necessary changes is here: http://foobar.iiitd.edu.in/turbo.pdf written by the trustworthy guys of IIITD. Its just two page so give it a read before submitting
What do you want me to do?
I am again saying i didn’t even saw your comment when i posted, I was busy modifying that code you can see that link.
Anyways i already awarded you 1 point that was all i had.
Never Use #include<conio.h> and getche() while submitting your code