← Back to topics
Topic

How to post code?

m
mi10215
I have problem.
Site wont accept my code...
And I am 100% sure that code is good.
But still say that I cant solve problem..
How to post code? In which format?
d
demjan0001
Don't be 100% sure ;)

First:

scanf("%d,%d", &N, &M);

in the description of the task, it isn't said between 2 number there is going to be ','.
So you should read like this

scanf("%d%d",&n,&m);



Second ( it's not mistake, but you shouldn't check it ):
when it is said in task that N and M are in range ( 0 .. 200 ), they will be in that range, so you don't need to check that.
So you don't need this if:

if(0 <= M && M <= 200 && 0<=N&&N<=200)
m
mi10215
And because of , it cant read my program properly?
Im pretty sure that my code is correct and its working :)

#include<stdio.h>

int main()
{

int N,M,z;
scanf("%d,%d", &N, &M);
if(0 <= M && M <= 200 && 0<=N&&N<=200)
{ z=M+N;
printf("%d",z);}
return 0;
}
d
demjan0001
look at the task description:
"From the standard input read two numbers M and N, 0<=M,N<=200. Output the sum of M and N to the standard output."

There should be 1 test case, but because this is the easiest one, there is no test case.
It is said read two number M and N, that means there won't be anything between them.
It is going to be "M[space]N" or "M[enter]N".

I have tried your code and as I thought it doesn't work. Your program expects comma between those 2 numbers.