answersLogoWhite

0

How if-else is replaced using conditional operator?

Updated: 8/20/2019
User Avatar

Wiki User

11y ago

Best Answer

in some special cases it is possible

in: if (cond) var= exp1; else var= exp2;
out: var= cond? exp1: exp2;

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How if-else is replaced using conditional operator?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How can you download c compiler?

write a c program to fine largest/smallest of 3no (using ?:ternary operator/conditional operator)


How do you write a c program to find biggest among two numbers using conditional operator?

int max (int a, int b) { return a>b?a:b; }


Make a sentences with pasy unreal conditional?

Pasy is an unreal word, that is conditional on not using it as a proper noun.


What is a sentence using the word conditional?

The judge issued a conditional pardon, all terms must be met before the defendant is released.


How pointer is declared using address operator?

int *ptr; PS: I don't know what do you mean by 'using address operator'


Which operator not overloaded in c plus plus?

The if statementex.if (index < 5)printf("Index is less than 5\n");elseprintf("index is greater or equal to 5\n");(You can also replace the "if" with a "?" and the "else" with a "?" -- no, that would be syntax error)


Is there any solved problems using De Morgan's laws?

The rules can be expressed in English as:The negation of a conjunction is the disjunction of the negations.The negation of a disjunction is the conjunction of the negations.The rules can be expressed in formal-languagewith two propositions P and Q as:where:&not; is the negation operator (NOT)is the conjunction operator (AND)is the disjunction operator (OR)&hArr; is a metalogic-1symbol meaning "can be replaced in a formal-proofwith"


How do you define power function without using operator?

using pow() function.. ..


What is the program for compare two strings using conditional operator in java?

System.out.println(a.equals(b) ? "They are equal" : "They are different");System.out.println(a.equals(b) ? "They are equal" : "They are different");System.out.println(a.equals(b) ? "They are equal" : "They are different");System.out.println(a.equals(b) ? "They are equal" : "They are different");


How do you find the greatest of three numbers using ternery operator?

Compare the first two numbers with the ternary operator. Store the result in a temporary variable. Compare the temporary variable with the third number, again using the ternary operator.


Why you are using conditional shortest path routing in delay tolerant networks?

for finding the shortest path


What are the safety requirements for using a manlift?

The safety requirements for using a manlift include but are not limited to ensuring the operator is using fall protection and checking that the operator is alert and in proper condition to use the equipment. It is also important to be certain the operator is properly trained for using a manlift as incorrect use may comprise the safety of many people.