Baixe o app para aproveitar ainda mais
Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original
/* * File: main.cpp * Author: joao * * Created on 30 de Março de 2016, 01:36 */ #include <cstdlib> #include <cstdio> using namespace std; float media(float n1, float n2) { return (n1 + n2) / 2; } char lerNota(float nota[]) { int i = 0; while (i < 4) { scanf("%f", ¬a[i++]); if (nota[i - 1] < 0 || nota[i - 1] > 10) { printf("\n A nota deve ser >0 e menor que 10 \n"); i--; } } } /* * */ int main(int argc, char** argv) { float notas[4]; int i = 0; lerNota(notas); while (i < 4) { printf("\nNota [%d] - [%.2f]\n", i, notas[i]); if (i % 2 == 1) printf("\n Media [%.2f]", media(notas[i - 1], notas[i])); i++; } return 0; }
Compartilhar