Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write the code in c Write a program that will get 3 integers from the user and t

ID: 3639911 • Letter: W

Question

write the code in c

Write a program that will get 3 integers from the user and then the program should call a function to sort the 3 integers. In main do the following: Prompt the user to enter 3 integers Print the numbers and their addresses to the screen Call function sort3 Integers that will sort the 3 integers Print the numbers and their addresses again Function swap: void swap(int *, int o); Function sort3Intcgcrs: void sort3Integers(int *, int *, int o); Call function swap when swapping from inside function sort3Integers

Explanation / Answer

#include<stdio.h>

void swap(int* , int*);
void sort3Integers(int*,int*,int*);

int main()
{
int a,b,c;

printf(" Enter the three integers : ");
scanf("%d%d%d",&a,&b,&c);

printf(" Nos. Address %d %d %d %d %d %d",a,&a,b,&b,c,&c);

sort3Integers(&a,&b,&c);

printf(" Sorted Values : %d , %d , %d ",a,b,c);
return 0;
}

void swap(int *m,int *n)
{
int t;
t = *m;
*m = *n;
*n = t;
}

void sort3Integers(int *x, int *y, int *z)
{
if(*y<*x)
swap(x,y);

if(*z<*x)
swap(x,z);

if(*z<*y)
swap(y,z);
}