//It’s the code for Ceil A-B problem in practice set
#include<stdio.h>
int main()
{
unsigned long a=0;
unsigned long b=0;
scanf("%lu %lu", &a, &b);
printf("%lu\n",(a-b));
printf("%lu\n", (a-b)^1);
return 0;
}
//It’s the code for Ceil A-B problem in practice set
#include<stdio.h>
int main()
{
unsigned long a=0;
unsigned long b=0;
scanf("%lu %lu", &a, &b);
printf("%lu\n",(a-b));
printf("%lu\n", (a-b)^1);
return 0;
}
You should not output the first line i.e. remove printf("%lu\n",(a-b)) .
#include<stdio.h>
int main()
{
unsigned long a=0;
unsigned long b=0;
scanf("%lu %lu", &a, &b);
printf("%lu\n", (a-b)^1);
return 0;
}
Again wrong…
What can i do ?
My way of implementation is correct ?
remove printf("%lu\n",(a-b)^1);
because we can not write ^
When a-b = 1 your answer will be zero , but it has leading zeroes . So it is giving WA .
Here is your corrected code .
# include < stdio.h>
int main()
{
unsigned long a=0;
unsigned long b=0;
unsigned long ans=0;
scanf("%lu %lu", &a, &b);
ans=(a-b)^1;
if (ans==0)
ans=2;
printf("%lu\n",ans); return 0;
}
Thanks. I forgot that fact. Now ok. Once again thank you.