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

Observed speedup and parallel overhead, Observed Speedup Observed speed...

Observed Speedup Observed speedup of a system which has been parallelized, is defined as:                             Granularity is one of the easiest and most extensi

What is jmx architecture, JMX is based on a 3-level architecture:   ?...

JMX is based on a 3-level architecture:   ? The Probe level have the probes (known as MBeans) instrumenting the resources. Also known as the Instrumentation level. ? The A

Subsequent step in karnaugh map, The subsequent step in Karnaugh map is to ...

The subsequent step in Karnaugh map is to map truth table in the map. Mapping is done by putting a 1 in respective square belonging to 1 value in truth table. This mapped map is us

Subtraction of 01100-00011 using 2's complement method, Subtraction of 0110...

Subtraction of 01100-00011 using 2's complement method Ans. Firstly 1's complement of 00011 is 11100 and 2's complement is 11100 + 1 = 11101. Thus If a last carry is

Define dynamic linking, Define dynamic linking.  Dynamic linking is sam...

Define dynamic linking.  Dynamic linking is same to dynamic loading, rather that loading being postponed unless execution time, linking is postponed. This feature is usually us

Explain what is meant by a bus, Question: (a) Comment on the general s...

Question: (a) Comment on the general structure of the IAS Computer, illustrate your answer using a diagram. (b) (i) Define CPU time. (a) (ii) A program runs in 10

Explain the concept of overriding, What is overriding? Overriding is an...

What is overriding? Overriding is an inherent part of association. It can show an ordered set of objects by writing {ordered} next to the appropriate association end. In 200

Options with dir in dos, Q. Options with DIR in DOS? You can use a numb...

Q. Options with DIR in DOS? You can use a number of options with DIR. To get the list of files from any other drive, denote the drive name followed by ':' with DIR. For exam

Subscript and an index in a table definition, What is the difference betwee...

What is the difference between a subscript and an index in a table definition? Ans) A subscript is a working storage data definition item, typically a PIC (999) where a value mu

Hiring problem algorithm, Consider the Hire Assistant problem. We interview...

Consider the Hire Assistant problem. We interview n candidates and always hire the best qualified so far. Let n = 5 for our example. Find the probabilities that we hire exactly 1 t

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