Pass your marks of CA-1(27), CA-2(28), and CA-3(0) of the course INT102 to the function with header high (float *, float *, float*). Write a function that should return the highest CA marks.
#include <stdio.h>
float high(float*, float*, float*);
int main() {
float CA1 = 27.0;
float CA2 = 28.0;
float CA3 = 0.0;
float highest_CA = high(&CA1, &CA2, &CA3);
printf("Highest CA mark is %.0f\n", highest_CA);
return 0;
}
float high(float* m1, float* m2, float* m3) {
float x1 = (*m1 > *m2) ? *m1 : *m2;
float x2 = (x1 > *m3) ? x1 : *m3;
return x2;
}
Comments
Leave a comment