WORKSHEET 2 Final
WORKSHEET 2 Final
WORKSHEET 2 Final
FLOWCHART/ ALGORITHM
Program 2.a:
1.START
2.Initialize X and Y
3. Calculate Z&Y and print
4. Calculate X|Y and print
5. Calculate X^Y and print
6. Calculate ~X and print
7. Calculate Y<<2 and print
8. Calculate Y>>2 and print
9. STOP
Program 2.b:
1.START
2. Define variables a, b, c as int data types
3. Input 3 numbers of your choice to be stored in a, b, c
4. Checks if a is greater than b and c both and if yes then prints a is greatest
5. Checks if b is greater than c and if yes then prints b is greatest
6. Prints c is greatest
7. STOP
Program 2.c:
1.START
2. Define variable year as int data types
3. Input year of your choice to be stored in year
4. Checks if it is leap year, if yes then prints leap year
5. Checks if it is century year, if yes then prints century year
6. Prints not a leap year
7. STOP
PROGRAM CODE
Input 2.a
Input 2.b
Input 2.c
1. Syntax Error
2. Runtime Error
3. Logic Error
PROGRAMS’ EXPLANATION (in brief)
Program 2.a:
This program functions to show the output of various bitwise operators.
Program 2.b: -
This program functions to find out the greatest number in a group of 3 numbers using ternary operators.
Program 2.c: -
This program functions to find if the year is a leap year, century year or neither.
OUTPUT
Output 2.a
Output 2.b
Output 2.c
LEARNING OUTCOMES
Design and develop modular programs for real world problems using control
structure and selection structure.