14.03.2015 Views

Apostila C da UFMG - Universidade do Minho

Apostila C da UFMG - Universidade do Minho

Apostila C da UFMG - Universidade do Minho

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

x *= y = z + 1;<br />

z %= v + v + v;<br />

v += x += y += 2;<br />

a. v=11, x=8, y=6, z=3<br />

b. v=0, x=1, y=2, z=3<br />

c. v=10, x=7, y=6, z=3<br />

d. v=13, x=10, y=6, z=3<br />

e. Nenhuma <strong>da</strong>s opções anteriores<br />

Resposta <strong>do</strong>s testes Aula 3:<br />

1-a 2-b 3-d 4-c 5-b 6-d 7-b 8-b 9-e 10-a 11-a 12-d<br />

Aula 4<br />

4 - Estruturas de controle de fluxo<br />

4.1 - O Coman<strong>do</strong> if<br />

Já introduzimos o coman<strong>do</strong> if. Sua forma geral é:<br />

if (condição) declaração;<br />

A expressão, na condição, será avalia<strong>da</strong>. Se ela for zero, a declaração não será executa<strong>da</strong>. Se a condição for diferente<br />

de zero a declaração será executa<strong>da</strong>. Aqui reapresentamos o exemplo de um uso <strong>do</strong> coman<strong>do</strong> if:<br />

#include <br />

main ()<br />

{<br />

int num;<br />

printf ("Digite um numero: ");<br />

scanf ("%d",&num);<br />

if (num>10)<br />

printf ("\n\nO numero e maior que 10");<br />

if (num==10)<br />

{<br />

printf ("\n\nVoce acertou!\n");<br />

printf ("O numero e igual a 10.");<br />

}<br />

if (num

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!