Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdbool.h>
- // para uso do "bool" em C99;
- // para compiladores anteriores, use:
- // #define bool int;
- // #define true 1;
- // #define false 0;
- // exemplo linha 86 em 3.variáveis.txt;
- int main()
- {
- // declaração de variável;
- int x, y;
- bool xbemmaior;
- // atribuição de variável (valor no domínio do tipo);
- x = 2;
- y = 3;
- // atribuição de variável (expressão de valor);
- x += y; // x = x + y;
- printf("x=%d\n", x);
- y += x; // y = y + x;
- printf("y=%d\n", y);
- x = 2 * x + y;
- printf("x=%d\n", x);
- printf("3 * y=%d\n", 3 * y);
- // variável do tipo lógico (true or false);
- xbemmaior = (x > (3 * y));
- if (xbemmaior = true)
- {
- printf("Verdade\n");
- }
- else
- {
- printf("Falso\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement