Module 2
1. Difference between switch ladder nested if
Sr. Features switch statement ladder if else statement nested if else
No. statement
1 In this we can In this case we can test In this case we can test In this case we can test
test only one multiple conditions multiple conditions multiple conditions
condition
2 In this we cannot In this case we can have In this case we can have In this case we can
have different only one expression but multiple conditions have multiple
conditions various value of the same independent of each conditions independent
expression other. of each other.
3 This is used This is used when there is This is typically used This is typically used
when there is only one condition but when there are multiple when there are
only one multiple values of the same conditions to be tested. multiple conditions to
condition and to be tested be tested.
one value of the
same to be tested
4 It can have It can have values based on It can have values based It can have values
values based on user choice on constraints based on constraints
constraints
5 In this first the In this case first the case is In this first the condition In this first the
condition is checked and then it is tested and then it comes condition is tested and
tested and then it switches to that case to else if the condition is then it comes to else if
comes to else if not true and then the other the condition is not
the condition is conditions are tested true and then the other
not true conditions are tested
2. What do you mean by data type Enlist the data types in c language along with example.
Give range of any three.
The data type decides the type of data and the memory location required for storing type of data in the
memory.
The data types divided into three types of:
[Link] Data type : These data types can be use in c as integer, fraction types numbers etc.
Ex: int a=9,floatb=3.6 etc
ii. Derived Data type: .The data types derived from the primitive or built-in data types are called
Derived Data Types. .
Ex: Array, function, pointer.
iii. User Define Data Type: User-defined data types are created by the user using a combination
of fundamental and derived data types in the C programming language.
Ex: Structure, Union etc.
The range of different data types are:
int -32768 to 32767
char -127 to 128
3. unsigned char 0 to 255
[Link] the difference between while do while and for loop.
4. write a program algorithm and flow chart for displaying the user entered no in words.
5.