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);
}``````

Edited by Nick Evan: n/a

6
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by WaltP

>ans is -2201 how?

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 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 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);
}``````