I'm a little confused about and error my compiler is giving me. The error message is "invalid operand to binary %." The compiler says that this code *avg = *range %10; Isn't this a valid binary operation in C?
#include<stdio. h>
#include<stdlib .h>
#define Lower_Limit 0
#define Upper_Limit 100
void readScores( float *s1,float *s2, float *s3);
void determineAvg(fl oat *s1,float *s2,float *s3, float *avg,int *range);
void printResults( float*avg);
int main(void){
float s1,s2,s3;
float A,B,C,D,F,avg;
int range;
readScores(&s1, &s2,&s3);
determineAvg(&s 1,&s2,&s3,&avg, &range);
printResults(&a vg);
return 0;
}
void readScores(floa t *s1, float *s2, float *s3){
printf("Enter three avgs to be calculated\n");
scanf("%f %f %f",s1,s2,s3) ;
}
void determineAvg(fl oat *s1,float *s2,float *s3,float *avg,int *range)
{
*avg = (*s1+*s2+*s3)/3;
*range = (*avg)%10;
printf("%d",*ra nge);
}
void printResults(fl oat *avg){
printf("This is avg one %f\n",*avg);
return;
}
#include<stdlib .h>
#define Lower_Limit 0
#define Upper_Limit 100
void readScores( float *s1,float *s2, float *s3);
void determineAvg(fl oat *s1,float *s2,float *s3, float *avg,int *range);
void printResults( float*avg);
int main(void){
float s1,s2,s3;
float A,B,C,D,F,avg;
int range;
readScores(&s1, &s2,&s3);
determineAvg(&s 1,&s2,&s3,&avg, &range);
printResults(&a vg);
return 0;
}
void readScores(floa t *s1, float *s2, float *s3){
printf("Enter three avgs to be calculated\n");
scanf("%f %f %f",s1,s2,s3) ;
}
void determineAvg(fl oat *s1,float *s2,float *s3,float *avg,int *range)
{
*avg = (*s1+*s2+*s3)/3;
*range = (*avg)%10;
printf("%d",*ra nge);
}
void printResults(fl oat *avg){
printf("This is avg one %f\n",*avg);
return;
}
Comment