Every i write code on codechef it shows correct output for sample cases but when i submit i display wrong answer,what can i do to solve these problems
If the output of your program does not match what the judges expect, you will get a Wrong Answer notification. Generally, incorrect output occurs because you have either misunderstood the problem, missed a trick in the question, did not check the extreme conditions. Just because your test cases passes on the sample cases does NOT mean that it will pass on all the extreme cases as well.
If you’re trying to solve a problem which is NOT from a live contest, you could share the problem and your solution here, and someone experienced enough might be able to help you out.
Here is a tutorial on how to write and compile a C program.
First Program in C
C programming fundamentals
While loop in C
Switch case statement in C
C programming pointers
Just to add, some really basic tactic that I (and I am sure a lot of other people) use is to write down some random test generator, create a slow brute-force solution that works perfectly on smaller test cases, and use the two programs to create like 1000 tests and their solutions and check them against my solution-to-be-submitted. This way I catch some cases I didn’t think about.
You can check this tutorial for executing your first Hello world program in C. This will give you a brief idea of general structure of a c program and it’s compilation and execution. Hope it helps.