Answer to Question #235030 in C for New

Question #235030
program that will use function accept() to input any 3 integer values. The program must also then use another function greatest() to determine and return the highest number. [10 marks]
1
Expert's answer
2021-09-10T01:47:40-0400


#include <stdio.h>
void accept();
int greatest();
int main()
{
    int a,b,c;
    void accept(){
        printf("\nEnter three integer numbers: \n");
        printf("\nEnter the first number: ");
        scanf("%d",&a);
        printf("\nEnter the second number: ");
        scanf("%d",&b);
        printf("\nEnter the third number: ");
        scanf("%d",&c);
    }
    int greatest(){
        if((a >= b) && (a >= c))
            return a;
        else if ((b >= a) && (b >= c))
            return b;
        else
            return c;
    }
    accept();
    printf("The greatest number is: %d", greatest());
    return 0;
}

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