blob: a745483857ace6bb77b73f6e7a0284c9d2848cf1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
//example 8.4
clc;
clear;
en=input("Enter the enable input level(1 or 0) : ") ;
r=input("enter the R input level(1 or 0) : " );//accepting the inputs from the user
s=input("enter the S input level(1 or 0) : " );
qn=input("Enter the previous output value(1 or 0) : ");
if en == 0 then // clculating the output
op = qn;
elseif (s==0 & r==0) then
op=qn;
elseif(s==1&r==1) then
disp('The inputs are illegal');
return;
else
op=s;
end
printf('\n \noutput (Qn+1) = %d ',op);//displaying the output
|