-
-
Save jtadeulopes/3845753 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #define LIMITE 50 | |
| int main(void) | |
| { | |
| int A=0, B=0, C=0, soma; | |
| printf("Digite um número inteiro: \n"); | |
| scanf("%d", &A); | |
| printf("Digite um número inteiro: \n"); | |
| scanf("%d", &B); | |
| printf("Digite um número inteiro: \n"); | |
| scanf("%d", &C); | |
| soma = A + B + C; | |
| if (soma > LIMITE) { | |
| printf("A soma dos valores é %d e é maior que %d. \n", soma, LIMITE); | |
| } else { | |
| printf("A soma dos valores é %d. \n", soma); | |
| } | |
| return(0); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main(void) | |
| { | |
| float altura, peso_ideal; | |
| char sexo; | |
| printf("Informe seu sexo (M ou F): \n"); | |
| scanf("%c", &sexo); | |
| printf("Informe sua altura: (Ex. 1.70) \n"); | |
| scanf("%f", &altura); | |
| if (sexo == 'M' || sexo == 'm') { | |
| peso_ideal = (72.7 * altura) - 62; | |
| printf("O peso ideal para o sexo Masculino é: %.2f \n", peso_ideal); | |
| } else if (sexo == 'F' || sexo == 'f') { | |
| peso_ideal = (62.1 * altura) - 48.7; | |
| printf("O peso ideal para o sexo Feminino é: %.2f \n", peso_ideal); | |
| } else { | |
| printf("%c não é um sexo válido.", sexo); | |
| } | |
| return(0); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main(void) | |
| { | |
| int a, b; | |
| printf("Digite um número inteiro: "); | |
| scanf("%d", &a); | |
| printf("Digite outro número inteiro: "); | |
| scanf("%d", &b); | |
| if (a > b) { | |
| printf("%d, %d", b, a); | |
| } else { | |
| printf("%d, %d", a, b); | |
| } | |
| return(0); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main(void) | |
| { | |
| int a, b, diferenca; | |
| printf("Digite um número inteiro: "); | |
| scanf("%d", &a); | |
| printf("Digite outro número inteiro: "); | |
| scanf("%d", &b); | |
| if (a == b) { | |
| printf("Informe números diferentes."); | |
| } else { | |
| if (a > b) { | |
| diferenca = a - b; | |
| printf("A diferença entre %d e %d é %d", a, b, diferenca); | |
| } else { | |
| diferenca = b - a; | |
| printf("A diferença entre %d e %d é %d", b, a, diferenca); | |
| } | |
| } | |
| return(0); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main(void) | |
| { | |
| float base, altura, area; | |
| printf("Informe a base do triangulo: \n"); | |
| scanf("%f", &base); | |
| printf("Informe a altura do triangulo: \n"); | |
| scanf("%f", &altura); | |
| area = (base * altura) / 2; | |
| printf("A área do triangulo é %f", area); | |
| return(0); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main(void) | |
| { | |
| int kwh; | |
| float consumo; | |
| printf("Informe o consumo em KWH: \n"); | |
| scanf("%d", &kwh); | |
| if (kwh <= 300) { | |
| consumo = kwh * 1.25; | |
| } else if (kwh >= 301 && kwh <= 500) { | |
| consumo = kwh * 1.50; | |
| } else if (kwh >= 501 && kwh <= 600) { | |
| consumo = kwh * 1.75; | |
| } else if (kwh >= 601 && kwh <= 800) { | |
| consumo = kwh * 2.00; | |
| } else if (kwh > 801 ) { | |
| consumo = kwh * 2.50; | |
| } | |
| printf("Total de sua conta de energia é %.2f \n", consumo); | |
| return(0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment