Answer to Question #308222 in C for ahmed

Question #308222

Write a program that takes three integers, and prints out the smallest number


1
Expert's answer
2022-03-12T04:55:34-0500
#include <stdio.h>




int findSmallest(int number1,int number2,int number3){
	if (number1 < number2 && number1 < number3)
	{
		return number1;
	}
	if (number2 < number1 && number2 < number3)
	{
		return number2;
	}
	return number3;
}




int main()
{
	int number1, number2, number3;
	printf("Enter the first integer: ");
	scanf("%d", &number1);
	printf("Enter the second integer: ");
	scanf("%d", &number2);
	printf("Enter the third integer: ");
	scanf("%d", &number3);
	printf("The smallest number is %d\n\n",findSmallest(number1, number2, number3));


	scanf("%d", &number2);
	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