Diferència entre revisions de la pàgina «M3 - Programació estructurada / Exercicis UF1: Expressions lògiques»

De wikiserver
Dreceres ràpides: navegació, cerca
 
(Hi ha 6 revisions intermèdies del mateix usuari que no es mostren)
Línia 6: Línia 6:
 
a) x=1 y=1  
 
a) x=1 y=1  
 
b) x=1 y=2  
 
b) x=1 y=2  
c) x=2 y=1
+
c) x=2 y=1  
d) x=2 y=2
+
d) x=2 y=2  
e) x=0 y=0
+
e) x=0 y=0  
f) x=1 y=0
+
f) x=1 y=0  
 
</pre>
 
</pre>
<!--
+
 
<pre>
 
a) x=1 y=1 False
 
b) x=1 y=2 False
 
c) x=2 y=1 True
 
d) x=2 y=2 True
 
e) x=0 y=0 False
 
f) x=1 y=0 True
 
</pre>
 
-->
 
 
2. (((x>3)&&(x<6)) || !((y>3)&&(y<6)))
 
2. (((x>3)&&(x<6)) || !((y>3)&&(y<6)))
 
<pre>
 
<pre>
a) x=3 y=3
+
a) x=3 y=3  
b) x=3 y=4
+
b) x=3 y=4  
c) x=4 y=3
+
c) x=4 y=3  
d) x=4 y=4
+
d) x=4 y=4  
</pre>
 
<!--
 
<pre>
 
a) x=3 y=3 True
 
b) x=3 y=4 False
 
c) x=4 y=3 True
 
d) x=4 y=4 True
 
 
</pre>
 
</pre>
-->
+
 
 
3. (z>x && z>y || x>=y)
 
3. (z>x && z>y || x>=y)
 
<pre>
 
<pre>
a) x=1 y=1 z=1
+
a) x=1 y=1 z=1  
b) x=1 y=2 z=3
+
b) x=1 y=2 z=3  
c) x=1 y=3 z=2
+
c) x=1 y=3 z=2  
d) x=2 y=1 z=3
+
d) x=2 y=1 z=3  
e) x=2 y=3 z=1
+
e) x=2 y=3 z=1  
f) x=3 y=2 z=1
+
f) x=3 y=2 z=1  
g) x=3 y=1 z=2
+
g) x=3 y=1 z=2  
 
</pre>
 
</pre>

Revisió de 18:11, 10 set 2022

Avalueu les següents condicions en funció dels valors corresponents de les variables

1. ((y<x) || ((y>1) && (x>1)))

a) x=1 y=1 
b) x=1 y=2 
c) x=2 y=1 
d) x=2 y=2 
e) x=0 y=0 
f) x=1 y=0 

2. (((x>3)&&(x<6)) || !((y>3)&&(y<6)))

a) x=3 y=3 
b) x=3 y=4 
c) x=4 y=3 
d) x=4 y=4 

3. (z>x && z>y || x>=y)

a) x=1 y=1 z=1 
b) x=1 y=2 z=3 
c) x=1 y=3 z=2 
d) x=2 y=1 z=3 
e) x=2 y=3 z=1 
f) x=3 y=2 z=1 
g) x=3 y=1 z=2