Programming Help

actually I have learned coding using turbo C
is the coding method same for C11 CGN 9.2
like for example to solve this problem I have learned the coding like this

#include < stdio.h>
#include <conio.h>
 void main()
 int{ A,B,S;
scanf("%d%d",& A&B);
printf("%d", S);

I see a few problems here:

  1. int{ A,B,S;

    This line doesn’t look right. May be you meant to write this:

    void main() {
        int A, B, S;
  2. scanf("%d%d",& A&B);

    May be you meant to write this: scanf("%d%d", &A, &B); (notice that you missed a comma)

  3. getch;

    Not sure what the purpose of this here is.

I’m sorry to be so bothersome…but I was actually told to do the coding that way…yes about the bracket I did make a mistake but i was told not to use any comma between &A n &B…nd getch is for holding the output…otherwise its gonna come n go in a mili second…
again I want to mention that I did the coding the way I do using the compiler turbo C…

You are not being bothersome.

It’s not valid C code if 1 and 2 are not addressed.

For 3, I understand why you may need that. But then you need to call the function. It should be getch();.

However, if you include that in the code that you submit to Toph, it will prevent your program from ending. Toph will assume that your program is taking too long to generate the necessary output. And, you will get CPU Limit Exceeded.

ok…got it…ill try submitting again following ur tips…khamsammida…:blush:

1 Like

yayyy…it was accepted…after so many trials though.:stuck_out_tongue_winking_eye::blush:

1 Like