Give the syntax of if-else statement, Computer Engineering

Assignment Help:

Give the syntax of "if-else" and "switch" statements and explain.

if else

This is used to decide whether to do something at a special point, or to decide between two courses of action.

Syntax of  if else

if (conditional expression) Statement1;

else

Statement2;

The following test decides whether a student has passed an exam with a pass mark of 45 if (result >= 45)

printf("Pass\n");

else

printf("Fail\n");

It is possible to use the if part without the else.

 

 


Related Discussions:- Give the syntax of if-else statement

What are the steps include constructing a functional model, What are the St...

What are the Steps include constructing a Functional Model Recognize input and output values Build data flow diagrams which shows functional dependencies Explain

What is assembler, Q. What is Assembler? An assembly program is used to...

Q. What is Assembler? An assembly program is used to transfer assembly language mnemonics to binary code for every instruction after the complete program has been written with

Variable ordering - forward checking, Variable ordering - Forward checking:...

Variable ordering - Forward checking: Hence this is different from variable ordering in two important ways as:  Whether this is a dead end when we will end up visiting a

Determine the begin - end keywords, Determine the begin - end keywords ...

Determine the begin - end keywords Group several statements together. Cause the statements to be evaluated sequentially (one at a time) -> Any timing within sequential group

What is the difference among save and save as, Use SAVE when you are revisi...

Use SAVE when you are revising an existing document. Use SAVE AS when you are making a new document from scratch or an existing document. This will remain the original document

What are various ids associated with a process, What are various IDs associ...

What are various IDs associated with a process? Unix identifies each process with a unique integer known as ProcessID. The process that implements the request for creation of a

Microprocessor, illustration of Z80 instruction set Computer

illustration of Z80 instruction set Computer

Drill-down features provided by abap/4 in interactive lists, What are the d...

What are the drill-down features provided by ABAP/4 in interactive lists? ABAP/4 gives some interactive events on lists such as AT LINE-SELECTION (double click) or AT USER-COM

Sound and complete, Dictator Dim wants to replace counting, in particular, ...

Dictator Dim wants to replace counting, in particular, counting the population of his land. To keep an accurate population count, Dictator Dim has instructed his secretary to add o

Switch statement with the use of nested if-else statement, Compare the use ...

Compare the use of switch statement with the use of nested if-else statement. If-else statement:  When there are many conditional statements that may all evaluate to true, bu

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd