Subject: Introduction to Programming
Title: "Working with Operators and Flow charts"
Question #1
State
the order of evaluation of the operators in each of the following C++
statements and show the value of x after each statement i s performed.
a) x =7 + 3 * 6 / 2 -
1 ;
b) x = 2 % 2 + 2 * 2
- 2 / 2 ;
c) x = ( 3 * 9 * ( 3
+ ( 9 * 3 /( 3 ) ) ) ) ;
d) x = 5 + 7 % 3;
e) x = 5 + (7 % 2);
f) x = (5 + 7) % 5;
g) !(6 <= 4) evaluates true or false
Question #2
Let X=1 and Y=2 then
determine whether each of the following expression is true or false.
Question #3
X >Y OR X>0 AND Y<0 Evaluates true or false
Question #4
Draw flow chart for following
BEGIN
INPUT a
INPUT b
p = 1
a = a + ( P*3)
b= a *(p+1)
print a
print b
print p
END
Question
#5
Draw a flow chart that takes unit consumed as input and
calculates electricity bill as follows:
If units consumed are less than or
equal to 300 then cost is Rs 3 per unit
If units are more than 300 then cost is
3.5 per unit and a surcharge of 5% is added to the bill
Instruction:
·
Assignments will be in printed form.
Work using Microsoft Office word
·
Use the Cover page given in last
assignment
·
Do your own work.
Click these links to access the complete file:
0 comments:
Post a Comment