MCS -11, December, 2020, QUESTION AND ANSWER
Solution-
Flowchart algorithm for the largest number among three numbers-
1. Start
2. Input A, B, and C
3. If (A>B) and (A>C) then print “A is greater”.
Else if (B>A) and (B>C) then print “B is greater”.
Else print “C is greater”.
4. Stop
Flowchart
THE CONDITIONAL OPERATOR IN C
The conditional operator works on three operands, so it is also known as the ternary operator. It is represented by two symbols, i.e., '?' and ':'.
If the first operand condition is true, the second operand represents the value entire conditional expression, if is false then the third operand represents the value.
The syntax is as follows:
(condition)? (expression1): (expression2);
If condition is true, expression1 is evaluated else expression2 is evaluated.
Let us see the following examples:
(i) x= (y<20) ? 9: 10;
This means, if (y<20), then x=9 else x=10;
Enumeration – It helps assign names to integer constants in the program. The keyword 'enum' is used. It is used to increase the readability of the code.
Typedef – Typedef defines a new name for an existing data type. It does not create a new data class.
High-level language
1. The language whose design is governed by the circuitry and the structure of the machine is known as the Machine language. This language is difficult to learn and use.
2. These languages have been designed to give better machine efficiency, i.e. faster program execution.
Low-level language
These languages are particularly oriented towards describing the procedures for solving the problem in a concise, precise and unambiguous manner. Every high level language follows a precise set of rules. They are developed to allow application programs to be run on a variety of computers. These languages are machine- independent.
Comments
Post a Comment