Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void){
- int cond;
- double G1,G2,G3,mediatot,medialuno;
- printf("Insira a média necessária para a aprovação:");
- scanf("%lf",&mediatot);
- printf("\nAgora insira as notas do aluno:");
- scanf("%lf %lf %lf",&G1,&G2,&G3);
- printf("\n");
- cond = aprovado(mediatot,G1,G2,G3);
- printf("%d\n\n",cond);
- if(cond == 0){
- printf("Aprovado!");
- }
- else if(cond == 1){
- printf("Prova Final!");
- }
- else if(cond == 2){
- printf("Reprovado!\n");
- }
- return 0;
- }
- int aprovado(double media,double g1, double g2, double g3){
- double soma;
- int final = 0;
- soma = (g1+g2+g3)/3;
- printf("media = %lf\n",soma);
- if(soma >= media){
- return 0;
- }
- if(g1 >= 3 && g2 >= 3 && g3 >= 3){
- final = 1;
- }
- if(media>soma && final == 1){
- return 1;
- }
- return 2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement