main()
{
int i=10,j=20;
j = i, j?(i,j)?i:j:j;
printf("%d %d",i,j);
}
Answers were Sorted based on User's Feedback
Answer / susie
Answer :
10 10
Explanation:
The Ternary operator ( ? : ) is equivalent for
if-then-else statement. So the question can be written as:
if(i,j)
{
if(i,j)
j = i;
else
j = j;
}
else
j = j;
Is This Answer Correct ? | 67 Yes | 11 No |
Answer / sweksha
#include<stdio.h>
#include<conio.h>
void main()
{ int i,k;
clrscr();
i=0; k=10;
k=i,k?(i,k)?k:k:i; //i is assigned to k
printf("\n%d %d",i,k);//0 0
i=0; k=10;
k=(i,k)?(i,k)?k:i:i; //(0,10) is T so k=k
printf("\n%d %d",i,k);//0 10
i=0; k=10;
k=(k,i)?(i,k)?k:k:i; //(10,0) is F so k=i
printf("\n%d %d",i,k); //0 0
i=0; k=10;
k=k,i?(i,k)?k:i:k; //k is assigned to k
printf("\n%d %d",i,k);//0 10
i=0; k=10;
k=(i,k)?(k,i)?k:i:k; //(0,10) is T and (10,0) is F so k=i
printf("\n%d %d",i,k);//0 0
getch();
}
Is This Answer Correct ? | 3 Yes | 1 No |
x=2 y=3 z=2 x++ + y++; printf("%d%d" x,y);
To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates.
19 Answers Amazon, BITS, Microsoft, Syncfusion, Synergy, Vector,
#define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }
4 Answers Google, HCL, Quick Heal, WTF,
main() { int i=5; printf(ā%dā,i=++i ==6); }
main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }
9 Answers CSC, GoDB Tech, IBM,
Is the following code legal? struct a { int x; struct a *b; }
abcdedcba abc cba ab ba a a
int a=1; printf("%d %d %d",a++,a++,a); need o/p in 'c' and what explanation too
main() { char *p="GOOD"; char a[ ]="GOOD"; printf("\n sizeof(p) = %d, sizeof(*p) = %d, strlen(p) = %d", sizeof(p), sizeof(*p), strlen(p)); printf("\n sizeof(a) = %d, strlen(a) = %d", sizeof(a), strlen(a)); }
Develop a routine to reflect an object about an arbitrarily selected plane
main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }
What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++<n) p = &arr[i]; *p = 0; }