-
Get output as swap
void main()
{
int a=27,b=46;
a=1?a-(b=1?((a=1?a+b:0)-b):0):0;
printf("a=%db=%d",a,b);
}
I got swap answer for 2 inputs.
Result are a=46,b=27;
I am not able to get output as swap when i read through scanf statements.
i.e., scanf("%d%d",&a,&b);printf("a=%db=%d",a,b);
Please help me what is the concepts behind this ?
Question asked by visitor sasikumar
-
Junior Member
Re: Get output as swap
hey buddy,
I got the right output. I donno y u didnt get the rt o/p. this is my program.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("enter a,b:");
scanf("%d%d",&a,&b);
a=1?a-(b=1?((a=1?a+b:0)-b):0):0;
printf("a=%d b=%d",a,b);
getch();
}
i tried with diff values and i got the desired o/p i mean swapped o/p.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules