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);
}
Step-by-step 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