Q. Given the following pseudo code: 


Use variables: category of type character
Display "input category" Accept category
If category= 'U'
Display "insurance is not available"
 Else If category= 'A' then
Display "insurance is double"
Else If category= 'B' then
Display "insurance is normal" 
Else If category= 'M' then
Display "insurance is medically dependent"
Else
Display "entry invalid"

Draw a flow chart for the same and dry run the given pseudocode if it is working fine.


Answer :-

Program :-
c = input("Enter category :- ")
if c != "U":
    if c!= "A" :
        if c != "B" :
            if c !=  "M":
                print("entry invalid")
            else :
                print("insurance is medically dependent")
        else :
            print("insurance is normal")
    else :
        print("insurance is double")
else :
    print("insurance is not available")
Output :-

Enter category :- U
insurance is not available
>>>
Enter category :- A
insurance is double
>>>
Enter category :- B
insurance is normal
>>>
Enter category :- M
insurance is medically dependent
>>>
Enter category :- Z
entry invalid
>>>

Flowchart :-

Click on image for clear view.

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post