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

Edited 6 Years Ago by Nick Evan: n/a

>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.

Edited 6 Years Ago by Narue: n/a

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

Click this and this

Edited 6 Years Ago by Nick Evan: n/a

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

This article has been dead for over six months. Start a new discussion instead.