answersLogoWhite

0


Best Answer

There is no "elseif" statement in C. You can only use "else" and "if" separately. This is a good reason for switch/case/break.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

if and else statement are used in C Programming to check the condition .when we have one condition we use if statement and if we have two or more condition then we ure if else

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why you use if and else statement in c language program?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What translators convert high-level language on statement-by-statement basis?

Machine level instructions can be converted to readable assembly language using a disassembler. If the machine instructions originated from a higher level language, there may also be a decompiler to create something resembling the original high level language version of the program.


What is the method used to implement an if else statement in C?

The else statement is an optional part of an if statement that is executed if the primary if condition is false.if (condition) true_statementelse false_statement


What statement instructs a program to run the garbage collector?

In the case of the Java language, you can use the command:System.gc();Note that this should be interpreted as a suggestion to run the garbage collector; there is no guarantee that it will run immediately.


Structure of If-Then statement?

if (condition) statement1 [else statement2] example: if (i==j); else if (j==k) printf ("i!=j, j==k\n); else printf ("i!=j, j!=k\n); here statement1 is an empty-statement, statement2 is another if-statement There are three forms of statements IF-THEN IF-THEN-ELSE IF-THEN-ELSIF Sequence of statements is executed only if the condition evaluates to TRUE If condition evaluates to FALSE or NULL, it does nothing In either case control passes to next statement after the IF-THEN structure IF THEN statements; END IF; Sequence of statements in the ELSE clause is executed only if the condition evaluates to FALSE or NULL IF THEN statements; ELSE statements; END IF;


Why you use if loop in telecoms?

No such thing as if-loop. if-else statement is not a loop.

Related questions

What translators convert high-level language on statement-by-statement basis?

Machine level instructions can be converted to readable assembly language using a disassembler. If the machine instructions originated from a higher level language, there may also be a decompiler to create something resembling the original high level language version of the program.


When to use else?

in a threaten statement


What is the method used to implement an if else statement in C?

The else statement is an optional part of an if statement that is executed if the primary if condition is false.if (condition) true_statementelse false_statement


Why you uses exception handling because you can handle exception using if Else statement?

We use exception handling so that the program can gracefully handle any situation that may be unexpected. We use try-catch for exception handling. if-else is a conditional logic checking mechanism


What is the syntax of a conditional statement in JavaScript?

In JavaScript we have the following conditional statements:if statement - you would use this statement to execute some code only if a specified condition is trueif...else statement - you would use this statement to execute some code if the condition is true and another code if the condition is falseif...else if....else statement - you would use this statement to select one of many blocks of code to be executedswitch statement - you would use this statement to select one of many blocks of code to be executedFor example: If StatementUse the if statement to execute some code only if a specified condition is true. Syntaxif (condition) {code to be executed if condition is true}If...else StatementUse the if....else statement to execute some code if a condition is true and another code if the condition is not true. Syntaxif (condition) {code to be executed if condition is true}If...else if...else StatementUse the if....else if...else statement to select one of several blocks of code to be executed. Syntaxif (condition1) {code to be executed if condition1 is true}else if (condition2){code to be executed if condition2 is true}else{code to be executed if condition1 and condition2 are not true}else{code to be executed if condition is not true}


What statement instructs a program to run the garbage collector?

In the case of the Java language, you can use the command:System.gc();Note that this should be interpreted as a suggestion to run the garbage collector; there is no guarantee that it will run immediately.


Is there a program that can help you make a programming language but you don't need to know a programming language?

No. In order to make or use a program or a programming language, you need to know a programming language.


What program language does Lego universe use?

Bad


Structure of If-Then statement?

if (condition) statement1 [else statement2] example: if (i==j); else if (j==k) printf ("i!=j, j==k\n); else printf ("i!=j, j!=k\n); here statement1 is an empty-statement, statement2 is another if-statement There are three forms of statements IF-THEN IF-THEN-ELSE IF-THEN-ELSIF Sequence of statements is executed only if the condition evaluates to TRUE If condition evaluates to FALSE or NULL, it does nothing In either case control passes to next statement after the IF-THEN structure IF THEN statements; END IF; Sequence of statements in the ELSE clause is executed only if the condition evaluates to FALSE or NULL IF THEN statements; ELSE statements; END IF;


Why you use if loop in telecoms?

No such thing as if-loop. if-else statement is not a loop.


Reserved word in assembly language program?

use of reserved word in assembly language


How to write an if then statement?

It depends on the language however most use the following syntax: if (expression) then statement else statement endif Note that the "then" and "endif" keywords are not used in all languages since they are implied by the statement's structure and are normally only found in verbose languages such as BASIC. In C and C++, for instance, we have the following form: if (expression) { statement; } else { statement; } The expression must be a boolean expression; one that evaluates true or false. If the expression evaluates to a number, the expression evaluates true when the number is non-zero, otherwise it is false. When the expression is true, the first statement is executed otherwise the second statement is executed. Often we do not wish to execute anything when an expression is false, only when it is true, so the else clause is optional. if (expression) statement; In languages that use braces {} to denote structure, they are usually optional for simple statements but mandatory for compound statements. A compound statement is a group of statements that are treated as being one statement. Either statement may itself be an if statement (a nested if): if (expression) { if (expression) { statement; } else { statement; } } else { statement; } Spreading if statements over multiple lines and using whitespace indentation helps to highlight the logic and structure of the statement. It is not possible to show whitespace indentation here, but here's the same example using periods instead of whitespace: if (expression) { ...if (expression) { ......statement; ...} else { ......statement; ...} } else { ...statement; } Note the use of blank lines to separate the inner (nested) if from the outer if.