Skip to content

Instantly share code, notes, and snippets.

@GabrielB12
Last active April 29, 2021 22:36
Show Gist options
  • Select an option

  • Save GabrielB12/f6f8e4f8bf23cee8f8e307a06756d6fd to your computer and use it in GitHub Desktop.

Select an option

Save GabrielB12/f6f8e4f8bf23cee8f8e307a06756d6fd to your computer and use it in GitHub Desktop.
calcular o cr
#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
Copy link

mt foda...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment