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 |
write a program in c to merge two array
‎#define good bad main() { int good=1; int bad=0; printf ("good is:%d",good); }
Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines
main() { int c = 5; printf("%d", main||c); } a. 1 b. 5 c. 0 d. none of the above
#define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12)); }
Write a C program to print ‘Campus Force training’ without using even a single semicolon in the program.
main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }
main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }
main() { int i=4,j=7; j = j || i++ && printf("YOU CAN"); printf("%d %d", i, j); }
How to reverse a String without using C functions ?
33 Answers Matrix, TCS, Wipro,
4. Main() { Int i=3,j=2,c=0,m; m=i&&j||c&I; printf(“%d%d%d%d”,I,j,c,m); }
There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same.