-2

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 by Nick Evan: n/a

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

>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 by Narue: n/a

0

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

0

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.

-1

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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.