Ans1.
Please type a number between 1 and 10 inclusive:
// It asks for the value of n
Suppose n = 5
// while loop is not executed as the number is greater than 1
Z=xy!
The value of x = 1
While x< n+1
Display x in the field of four characters
1111
X=2
Display a return character
======
The value of x is 1
X is less the n +1
====
X=2
The value of y =1
The value of y is less than n+1
!
The value of x =1
Z=x*y
Z=1
X=2
Y=2
Ans2
(i). When the input is 0
The output is:
Sorry, your number is invalid
Please type a number between 1 and 10 inclusive:
(ii). When the input is 5
The output is
======
====
Z=1
X=2
Y=2
(iii). When the input is 10
The output is
======
====
Z=1
X=2
Y=2
(iv). When the input is 17
The output is:
Sorry, your number is invalid
Please type a number between 1 and 10 inclusive:
Ans3.
// The main function
//get a number between 1 and 10 inclusive
DISPLAY “Please type a number between 1 and 10 inclusive:”
GET n
// Module 1
//check the validity of n
DOWHILE (n < 1 OR n > 10)
DISPLAY “Sorry, your number is invalid”
DISPLAY “Please type a number between 1 and 10 inclusive:”
GET n
ENDDO
// Module 2
//display headings
DISPLAY “z=xy |”
x = 1
DOWHILE x < n + 1
DISPLAY x in a field of 4 characters
x = x + 1
ENDDO
DISPLAY a return character to start a new line
// Module 3
//display heading underlines
DISPLAY “======”
x = 1
DOWHILE x < n + 1
DISPLAY “====”
x = x + 1
ENDDO
DISPLAY a return character to start a new line
// Module 4
//compute and display something
y = 1
DOWHILE y < n + 1
DISPLAY y in a field of 4 characters
DISPLAY “ |”
x = 1
DOWHILE x < n + 1
z = x * y
DISPLAY z in a field of 4 characters
x = x + 1
ENDDO
// Module 5
// The display module
DISPLAY a return character to start a new line
y = y + 1
ENDDO
END
//end algorithm
Ans5.
By using deduction method prove the following arguments are valid (This can be done by using truth table)
(i). Pà~Q
= ~(P à ~Q)
= ~P V ~Q
= ~ (P & Q) is valid
R V (~S & ~T)
= (R V ~S) & ~ T is valid
(S V P) & ~R
= (S & ~R) V (P & ~R) is valid
~ (S V Q)
= ~S & ~ Q is valid
(ii). (~A V B) àC
= ~((~A V B) àC)
= (~(~A V B)) V ~C
= (A & ~B) V ~C is valid
~(A & D)
= ~A V ~D is valid
D is only terminal so it’s valid
C V E is also valid.
Note: This can be done by using rules in the attached File and by using Truth Table.
KH97
But you can order it from our service and receive complete high-quality custom paper. Our service offers Information technology essay sample that was written by professional writer. If you like one, you have an opportunity to buy a similar paper. Any of the academic papers will be written from scratch, according to all customers’ specifications, expectations and highest standards.”