Exercícios Preparação para Avaliação I

De MediaWiki do Campus São José
Revisão de 08h25min de 4 de novembro de 2015 por Eraldo (discussão | contribs) (Criou página com 'Exercício 1 <syntaxhighlight lang=c> →‎indicar o valor impresso das variáveis: #include <stdio.h> main () { int x,y,z; x = !( 5 || 0 ); printf ("x=%d\n",x); y = !( 1 ||...')
(dif) ← Edição anterior | Revisão atual (dif) | Versão posterior → (dif)
Ir para navegação Ir para pesquisar

Exercício 1

/* indicar o valor impresso das variáveis */
#include <stdio.h>
 
main ()
{
  int x,y,z;

  x = !( 5 || 0 );   
  printf ("x=%d\n",x);      
  y = !( 1 || 0 && 0 );
  printf ("y=%d\n",y);     
  z = !( ( 20 || 0 ) && 0 );
  printf ("z=%d\n",z); 
}

Exercício 2

<syntaxhighlight lang=c> /* indicar o valor impresso das variáveis */

  1. include <stdio.h>

main () {

 int x,y,z;
    
 x=10;
 y=6;
 printf("x=%d\n y=%d\n", x, y=!y);
 y=x+y+5;
 z = ( ( x-6 && y>5 ) || !0 ) * 50;
 printf ("z=%d\n",z); 

}

Exercício 3

<syntaxhighlight lang=c> /* indicar o valor impresso das variáveis */

  1. include <stdio.h>

main () {

 int x,y,z;
    
 x=10;
 y=6;
 printf("x=%d\n y=%d\n", x, y=y==x);
 y=x+y+5;
 z = ( ( x<=y && y>!(x=9) ) || z ) * x;
 printf ("z=%d\n",z); 

}