Question

Write a C function called min which takes 2 integers as input, and returns the smallest...

Write a C function called min which takes 2 integers as input, and returns the smallest as the result?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

#include <stdio.h>
int min(int a, int b)
{
if(a<b)
return a;
else
return b;
}
int main(void) {
int a,b;
printf("Enter first integer:");
scanf("%d",&a);
printf("Enter second integer:");
scanf("%d",&b);
printf("Minimum integer is: %d",min(a,b));
return 0;
}

output:

Enter first integer:6

Enter second integer:8

Minimum integer is: 6

please give thumbs up or do comment in case of any query. Thanks.

Add a comment
Know the answer?
Add Answer to:
Write a C function called min which takes 2 integers as input, and returns the smallest...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT