Last active
November 1, 2016 03:13
-
-
Save tuxcuiabano/ec903a1372d683839265eae6680f13db to your computer and use it in GitHub Desktop.
Prova 2 MSI A
This file contains 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
// | |
// main.c | |
// Prova | |
// | |
// Created by Pedro Clarindo da Silva Neto on 26/09/16. | |
// Copyright © 2016 Pedro Clarindo da Silva Neto. All rights reserved. | |
// | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
float calcmedia(float x, float y, float z); | |
int main() | |
{ | |
float vetbim[4], nota1, nota2, conceito, ma; | |
int disciplinas, bimestre; | |
for (disciplinas=1;disciplinas<=5;disciplinas++) | |
{ | |
printf("Disciplina número %d\n", disciplinas); | |
for (bimestre=1;bimestre<=3;bimestre++){ | |
printf("Digite a nota da 1ª prova do %dº bimestre\n", bimestre); | |
scanf("%f", ¬a1); | |
printf("Digite a nota da 2ª prova do %dº bimestre\n", bimestre); | |
scanf("%f", ¬a2); | |
printf("Digite a nota do conceito do %dº bimestre\n", bimestre); | |
scanf("%f", &conceito); | |
printf("-------------------------------------------\n"); | |
if (bimestre==1){ | |
vetbim[0]=calcmedia(nota1,nota2,conceito); | |
printf("Média do 1º bimestre - %f\n", vetbim[0]); | |
printf("+++++++++++++++++++++++++++++++++++++++++++\n"); | |
printf("+++++++++++++++++++++++++++++++++++++++++++\n"); | |
} | |
if (bimestre==2){ | |
vetbim[1]=calcmedia(nota1,nota2,conceito); | |
printf("Média do 2º bimestre - %f\n", vetbim[1]); | |
printf("+++++++++++++++++++++++++++++++++++++++++++\n"); | |
printf("+++++++++++++++++++++++++++++++++++++++++++\n"); | |
} | |
if (bimestre==3){ | |
vetbim[2]=calcmedia(nota1,nota2,conceito); | |
printf("Média do 3º bimestre - %f\n", vetbim[2]); | |
printf("+++++++++++++++++++++++++++++++++++++++++++\n"); | |
printf("+++++++++++++++++++++++++++++++++++++++++++\n"); | |
} | |
} | |
vetbim[3] = 1 + rand() % 10; | |
printf("Média do 4º bimestre - %f\n", vetbim[3]); | |
printf("+++++++++++++++++++++++++++++++++++++++++++\n"); | |
printf("+++++++++++++++++++++++++++++++++++++++++++\n"); | |
ma=(vetbim[0]+vetbim[1]+vetbim[1]+vetbim[3])/4; | |
printf("Sua média anual da %dª disciplina é %.2f\n", disciplinas, ma); | |
printf("=======================================================\n"); | |
printf("=======================================================\n"); | |
printf("=======================================================\n"); | |
} | |
return 0; | |
} | |
float calcmedia(float x, float y, float z){ | |
return (((x+y)/2)*0.8)+z; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment