#include<stdio.h>
#include<stdlib.h>
float * soma( float * vr , int qnt, float * med, int * a) ;
void maiorvalor( float * vimp, float * mval, int qnt ) ;
int main( ) {
float med, mval, vr;
int qnt, i, a = 0 ;
printf ( "informe a quantidade de pessoas a serem fiscalizadas: \n " ) ;
float * vimp = soma( & vr, qnt, & med, & a) ;
maiorvalor( vimp,& mval, qnt) ;
printf ( "a soma de todos os valores: %f\n " , vr
) ; printf ( "a media dos valores: %f\n " , med
) ; printf ( "o maior valor foi: %f\n " , mval
) ; printf ( "a quantidade de pessoas acima da media foi: %d\n " , a
) ;
for ( i= 0 ; i< qnt; i++ ) {
printf ( " %d valor : %f\n " , i
+ 1 , vimp
[ i
] ) ; }
return 0 ;
}
float * soma( float * vr, int qnt, float * med, int * a) {
int i;
float * vimp
= ( float * ) malloc ( qnt
* sizeof ( float ) ) ; for ( i= 0 ; i< qnt; i++ ) {
printf ( "informe o valor em debito da %d%c pessoa\n " , i
+ 1 , 167 ) ; * vr += vimp[ i] ;
}
* med=* vr/ qnt;
for ( i= 0 ; i< qnt; i++ ) {
if ( vimp[ i] >* med) {
( * a) ++;
}
}
return vimp;
}
void maiorvalor( float * vimp, float * mval, int qnt) {
int i;
for ( i= 0 ; i< qnt; i++ ) {
if ( vimp[ i] >* mval) {
* mval= vimp[ i] ;
}
}
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8c3RkbGliLmg+CgpmbG9hdCogc29tYShmbG9hdCAqdnIgLGludCBxbnQsIGZsb2F0ICptZWQsIGludCAqYSk7CnZvaWQgbWFpb3J2YWxvcihmbG9hdCAqdmltcCwgZmxvYXQgKm12YWwsIGludCBxbnQgKTsKCmludCBtYWluKCl7CiAgICAgZmxvYXQgbWVkLCBtdmFsLHZyOwogICAgIGludCBxbnQsaSxhID0gMDsKCiAgICBwcmludGYoImluZm9ybWUgYSBxdWFudGlkYWRlIGRlIHBlc3NvYXMgYSBzZXJlbSBmaXNjYWxpemFkYXM6IFxuIik7CiAgICBzY2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