Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Version -NA
*******************************************************************************/
1.1 Rima is working in State Electricity Board Project. She got the following requirement. The
following information has to be accepted from the user to calculate the net electricity bill amount.
• User ID
• User Name
Unit consumed = (Last month meter reading) – (Current month meter reading)
Write pseudo code to print the electricity bill. The bill should be in the following format
User ID:
User Name:
Unit Consumed:
Net amount:
SOL:
BEGIN
DEclare fixed_charges=100
ACCEPT userid
ACCEPT username
ACCEPT LMR
ACCEPT CMR
CALCULATE unitconsumed=CMR-LMR
CALCULATE netamt=unitconsumrd*1.15+fixedcharges
END
/***************************************************************************/
1.2 Organization employees are recognized with different tags based on their experience.
0 - <3 Blue
3 - <5 Grey
5 - <10 Yellow
>10 Red
Write pseudo code to accept the experience and display their tag Color.
SOL:
BEGIN
ACCEPT n
PRINT "empband=Blue"
PRINT "empband=yellow"
ELSE empexp>=10
print "empband=Red"
ENDFOR
END
/***********************************************************************************/
QUES 1.3: Write pseudo code to print the following mathematical series 0 1 1 2 3 5 8 13 21 …. N. Where
N is accepted from the user.
SOL : BEGIN
DECLARE a AS INTEGER
INITIALISE a TO 0
DECLARE b AS INTEGER
INITIALISE b TO 1
DECLARE n AS INTEGER
PRINT “enter the term upto which you want to print fibonnaci series”
ACCEPT n
IF var <=0
next=var
ELSE
Next=a+b
a=b
b=next
END IF
PRINT next
END FOR
END
/***********************************************************************************/
1.4 Write a pseudo code to accept a number and check whether a given number is an Armstrong
number.For example, 371 is an Armstrong number
SOL : BEGIN
ACCEPT number
CALCULATE original_number=number
WHILE original_number!= 0
CALCULATE original_number=original_number/10
ENDWHILE
IF result==number
ENDIF
END
/***********************************************************************************/
1.5 Write a pseudo code to convert a binary number to decimal. For an Example, if the given input is
00000100(binary number),then the output
ACCEPT binary
INITIALISE power TO 0
WHILE (binary>0)
DO
CALCULATE power=power+1
CALCULATE binary=binary/10
ENDWHILE
PRINT decimal
END
/***********************************************************************************/
1.6 Write a pseudo code to accept 10 numbers in an array and do the following using a loop.
INITIALIASE var 0 TO 9
FOR var 0 TO 9
ACCEPT array[var]
ENFFOR
INITIALISE min=array[0]
FOR(var 0 TO 9)
ENDIF
ENDFOR
PRINT min="min"
FOR(var 0 TO 9)
IF(array[var] % 2 == 0)
PRINT array[var]
ENDIF
ENDFOR
FOR(var 0 TO 9)
IF(array[var] % 2 != 0)
PRINT array[var]
ENDIF
ENDFOR
END
/***********************************************************************************/
1.7 Modify the below Pseudocode to implement good programming practices. The below
Pseudocode is used to calculate total price of a product
including tax.
BEGIN
Accept p
tc=p*.56
END
SOL : BEGIN
ACCEPT product_price
END
/***********************************************************************************/