Write a program whose inputs are three integers, and whose outputs are the largest of the three values and the smallest of the three values. If the input is 7 15 3, the output is: largest: 15 smallest: 3 Your program should define and call two functions: Function LargestNumber(integer num1, integer num2, integer num3) returns integer largestNum Function SmallestNumber(integer num1, integer num2, integer num3) returns integer smallestNum

Respuesta :

Answer:

int SmallestNumber(int num1, int num2, int num3){

int smallest;

if (num1 >num2){

smallest=num2;

}

else {

smallest=num1;

}

if(smallest <num3){

smallest=num3;

}

}

int LargestNumber(int num1, int num2, int num3){

int largest;

if (num1 <num2){

largest=num2;

}

else {

largest=num1;

}

if(largest>num3){

largest=num3;

}

}

void main(){

int num1,num2,num3;

printf("enter values");

scanf("%d%d%d",&num1,&num2,&num3);

int smallest=SmallestNumber(num1,num2,num3);

int largest=LargestNumber(num1,num2,num3);

}

Explanation:

we are comparing first two numbers and finding largest among those. After getting largest comparing that with remaining if it is greater then it will be largest of three. Same logic applicable to smallest also

fichoh

The program which evaluates the values in a function and outputs the largest and smallest values written in python 3 is given as follows :

def smallest(num1, num2, num3):

#initialize a function which takes 3 parameters

if (num1 < num2):

#compares the first and second values

smallest = num1

#assign the smaller value to a variable

else :

smallest = num2

if num3 < smallest:

smallest = num3

print('smallest integer : ', smallest)

#displays the minimum of the values

def largest(num1, num2, num3):

#initialize a function that takes 3 parameters

if (num1 > num2):

#compares the first two values

largest = num1

#assign the larger to another variable

else :

largest = num2

if num3 > largest:

#compare the varibale with the third value

largest = num3

print('largest integer : ', largest)

#displays the largest of the 3 variables.

Learn more : https://brainly.com/question/14942732