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 C function to search a number in the given list of numbers. donot use printf and scanf
How we print the table of 3 using for loop in c programing?
how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.
0 Answers Mbarara University of Science and Technology,
How to use power function under linux environment.eg : for(i=1;i<=n;i++){ pow(-1,i-1)} since it alerts undefined reference to 'pow'.
main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit >> (i - (i -1))); } } a. 512, 256, 0, 0, 0 b. 256, 256, 0, 0, 0 c. 512, 512, 512, 512, 512 d. 256, 256, 256, 256, 256
write a origram swaoing valu without 3rd variable
void main() { unsigned giveit=-1; int gotit; printf("%u ",++giveit); printf("%u \n",gotit=--giveit); }
void main() { void *v; int integer=2; int *i=&integer; v=i; printf("%d",(int*)*v); }
Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?
Who could write how to find a prime number in dynamic array?
#define a 10 int main() { printf("%d..",a); foo(); printf("%d..",a); return 0; } void foo() { #undef a #define a 50 }
How to reverse a String without using C functions ?
33 Answers Matrix, TCS, Wipro,