mercredi 8 mars 2017

Making a truth table usinfg switch and while loop (Only for the Smart)

Complete the truth table shown in Table 1 by finding the truth values of the boolean expressions for all possible combinations of the boolean inputs r, s, and t. As an example, if r = 0, s = 0 and t = 0, then (!r || (s && t)) = !false || (false && false), which evaluates to 1(true). Additionally, the De Morgan’s Law proves that certain expressions have the same truth value: ! (𝒓 || 𝒔) ≡ ! 𝒓 && ! 𝒔 ! (𝒓 && 𝒚) ≡ ! 𝒓 || ! 𝒔 a) Using while loop and switch-case statements, write a program that takes the user input: r,s and t to produce the results for the expressions in the right-hand.

Aucun commentaire:

Enregistrer un commentaire