Question 1:

main()
{int i=-3,j=2,k=0,m;
m=++i||++j&&++k;
printf("\n%d%d%d%d",i,j,k,m);
}

ans is -2201 how?

Question 2:

main()
{
int a,b;
a=sumdig(123);
b=sumdig(123);
printf("\n%d%d",a,b);
}
sumdig(int s)
{
static int s=0;
int d;
if (n!=0)
{
d=n%10;
n=(n-d)/10;
s=s+d;
sumdig(n);
}
else
return(s);
}

please explain the ans

Recommended Answers

All 5 Replies

>ans is -2201 how?
>please explain the ans
>please explain

Why don't you start a new thread instead of hijacking an old one, then try to explain it yourself and we'll make corrections. We're not here to do your homework.

p.s. Bumping the thread with the same question after a few minutes is extremely rude.

Thread split, posts merged, bumps removed and tags added. What a great first impression. :icon_frown:

Click this and this

Question 1:

main()
{int i=-3,j=2,k=0,m;
m=++i||++j&&++k;
printf("\n%d%d%d%d",i,j,k,m);
}

ans is -2201 how?

There are no spaces in that printf() statement to separate the numbers.

Question 1:

main()
{int i=-3,j=2,k=0,m;
m=++i||++j&&++k;
printf("\n%d%d%d%d",i,j,k,m);
}

ans is -2201 how?

Question 2:

main()
{
int a,b;
a=sumdig(123);
b=sumdig(123);
printf("\n%d%d",a,b);
}
sumdig(int s)
{
static int s=0;
int d;
if (n!=0)
{
d=n%10;
n=(n-d)/10;
s=s+d;
sumdig(n);
}
else
return(s);
}

please explain the ans

what is d value of n.
and in d previous problem d ans should have been -2311

d is the remainder of n/10. If n=32, d=2.
There is no d in the previous problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.