Mudanças entre as edições de "PRG29002-2015-2-Aval1A"
Ir para navegação
Ir para pesquisar
Linha 21: | Linha 21: | ||
Z = ______ | Z = ______ | ||
+ | |||
+ | Questão 2 | ||
+ | |||
+ | <syntaxhighlight lang=c> | ||
+ | #include <stdio.h> | ||
+ | |||
+ | main () | ||
+ | { | ||
+ | int x,y; | ||
+ | |||
+ | x=8; | ||
+ | y=2; | ||
+ | if (x>5 && !(y==2)){ | ||
+ | y=x+y; | ||
+ | x++; | ||
+ | if (x>30) y++; else y--; | ||
+ | y=y+5; | ||
+ | if (y>2) { | ||
+ | if (y==0) | ||
+ | x=0; | ||
+ | else | ||
+ | x=9; | ||
+ | x=x+1; | ||
+ | } | ||
+ | x=x*3; | ||
+ | } else { | ||
+ | y=y*2; | ||
+ | x=y+1; | ||
+ | } | ||
+ | printf("x= %d e y=%d\n",x,y); | ||
+ | } | ||
+ | |||
+ | </syntaxhighlight> |
Edição das 22h26min de 17 de novembro de 2015
Nome:_____________________________________________
Questão 1
#include <stdio.h>
main ()
{
int x,y,z;
x=2;
y=6;
y=y%x;
z = ( ( x-1 || y>5 ) && !0 ) * 10;
printf ("z=%d\n",z);
}
Z = ______
Questão 2
#include <stdio.h>
main ()
{
int x,y;
x=8;
y=2;
if (x>5 && !(y==2)){
y=x+y;
x++;
if (x>30) y++; else y--;
y=y+5;
if (y>2) {
if (y==0)
x=0;
else
x=9;
x=x+1;
}
x=x*3;
} else {
y=y*2;
x=y+1;
}
printf("x= %d e y=%d\n",x,y);
}