Answer to Question #293950 in C for Prathamesh

Question #293950

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.


1
Expert's answer
2022-02-06T07:08:33-0500
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS