#include <stdio.h>
void validar( float * var) {
while ( 1 ) {
if ( * var >= 0 && * var <= 10 ) return ;
printf ( "\n Nota invalida, tente novamente: " ) ; }
}
int main( ) {
float lab, avaliacao, exame;
printf ( "Entre com a nota do trabalho de laboratorio: " ) ; validar( & lab) ;
printf ( "Entre com a nota da avaliação bimestral: " ) ; validar( & avaliacao) ;
printf ( "Entre com a nota do exame final: " ) ; validar( & exame) ;
float media = ( lab * 2 + avaliacao * 3 + exame * 5 ) / ( 2 + 3 + 5 ) ;
printf ( ( media
< 3 ) ? "\n Aluno reprovado.\n " : ( media
< 5 ) ? "\n Aluno em recuperação\n " : "\n Aluno aprovado\n " ) ; }
//https://pt.stackoverflow.com/q/323110/101
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIHZhbGlkYXIoZmxvYXQgKnZhcil7CiAgICB3aGlsZSAoMSkgewogICAgICAgIHNjYW5mKCIlZiIsIHZhcik7CiAgICAgICAgaWYgKCp2YXIgPj0gMCAmJiAqdmFyIDw9IDEwKSByZXR1cm47CiAgICAgICAgcHJpbnRmKCJcbk5vdGEgaW52YWxpZGEsIHRlbnRlIG5vdmFtZW50ZTogIik7CiAgICB9Cn0KCmludCBtYWluKCkgewogICAgZmxvYXQgbGFiLCBhdmFsaWFjYW8sIGV4YW1lOwogICAgcHJpbnRmKCJFbnRyZSBjb20gYSBub3RhIGRvIHRyYWJhbGhvIGRlIGxhYm9yYXRvcmlvOiAiKTsKICAgIHZhbGlkYXIoJmxhYik7CiAgICBwcmludGYoIkVudHJlIGNvbSBhIG5vdGEgZGEgYXZhbGlhw6fDo28gYmltZXN0cmFsOiAiKTsKICAgIHZhbGlkYXIoJmF2YWxpYWNhbyk7CiAgICBwcmludGYoIkVudHJlIGNvbSBhIG5vdGEgZG8gZXhhbWUgZmluYWw6ICIpOwogICAgdmFsaWRhcigmZXhhbWUpOwogICAgZmxvYXQgbWVkaWEgPSAobGFiICogMiArIGF2YWxpYWNhbyAqIDMgKyBleGFtZSAqIDUpIC8gKDIgKyAzICsgNSk7CiAgICBwcmludGYoKG1lZGlhIDwgMykgPyAiXG5BbHVubyByZXByb3ZhZG8uXG4iIDogKG1lZGlhIDwgNSkgPyAiXG5BbHVubyBlbSByZWN1cGVyYcOnw6NvXG4iIDogIlxuQWx1bm8gYXByb3ZhZG9cbiIpOwp9CgovL2h0dHBzOi8vcHQuc3RhY2tvdmVyZmxvdy5jb20vcS8zMjMxMTAvMTAx