Last active
April 29, 2021 22:36
-
-
Save GabrielB12/f6f8e4f8bf23cee8f8e307a06756d6fd to your computer and use it in GitHub Desktop.
calcular o cr
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> | |
| #include <stdlib.h> | |
| int main() | |
| { | |
| int num1, num2, num3; | |
| printf("Digite a quantidade de materias com peso 1: "); | |
| scanf("%d", &num1); | |
| printf("Digite a quantidade de materias com peso 2: "); | |
| scanf("%d", &num2); | |
| printf("Digite a quantidade de materias com peso 3: "); | |
| scanf("%d", &num3); | |
| float soma1 = 0, soma2 = 0, soma3 = 0, aux, resposta; | |
| for (int i = 0; i < num1; i++) | |
| { | |
| printf("Digite a %d nota de peso 1: ", i + 1); | |
| scanf("%f", &aux); | |
| soma1 += aux; | |
| } | |
| for (int i = 0; i < num2; i++) | |
| { | |
| printf("Digite a %d nota de peso 2: ", i + 1); | |
| scanf("%f", &aux); | |
| soma2 += aux; | |
| } | |
| for (int i = 0; i < num3; i++) | |
| { | |
| printf("Digite a %d nota de peso 3: ", i + 1); | |
| scanf("%f", &aux); | |
| soma3 += aux; | |
| } | |
| resposta = ((soma1 * 1) + (soma2 * 2) + (soma3 * 3)) / (num1 + (num2 * 2) + (num3 *3)); | |
| printf("O seu CR e de: %.4f\n", resposta); | |
| return 0; | |
| } |
mtaciano
commented
May 31, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment