Finding Smallest Number Among Three (Using C and function)
I got this problem while learning C in school and its worth learning. And you can use same method for C++ also. Write a program that takes three integers as input and prints the smallest and largest of these numbers. The main program must prompt for integers and read them. Write the functions largest() and smallest() that receive the entered numbers as their parameters. Correspondingly, the functions shall return values corresponding to their names. #include <stdio.h> int largest(int first, int second, int third); //making the function name and giving parameters int smallest(int first, int second, int third); int main() { int a,b,c,largestNumber,smallestNumber; printf("Enter the 1. number: "); scanf("%d",& a); printf("Enter the 2. number: "); scanf("%d",& b); printf("Enter the 3. number: "); scanf("%d",& c); largestNumber=largest(a,b,c); ...