5 1 2 return 0; 1 add(a, b, &sum); printf("The sum of %d and %d is %d\n", a, b, sum); svoid add (int n1, int n2, int *total) { *total = n1 + n2; // *total targets what total points at 3 Something similar happens inside the scanf library function. Function Exercise Write a program named order3.c with a function tripleorder (with void return-type which sorts the values of three integer variables (a, b, and c) into ascending order. The parameters to the function must be three pointers to these three variables. After the function returns the values in the variables should now be sorted from smallest to largest in the order that the variables were passed to the function. This means that the variable of the first pointer will hold the smallest value, and that the variable of the third pointer will hold the largest after the function is called. The main method should ask the user for three numbers, call this function, and print out the three numbers from smallest to largest (on one line with one space between each number) regardless of the order of the numbers entered by the user. To make this precise: If the variables to hold the users three numbers are, in order a, b, and c then use printf("%d %d %d\n", a, b, c); to print out the values in those variables.
5 1 2 return 0; 1 add(a, b, &sum); printf("The sum of %d and %d is %d\n", a, b, sum); svoid add (int n1, int n2, int *total) { *total = n1 + n2; // *total targets what total points at 3 Something similar happens inside the scanf library function. Function Exercise Write a program named order3.c with a function tripleorder (with void return-type which sorts the values of three integer variables (a, b, and c) into ascending order. The parameters to the function must be three pointers to these three variables. After the function returns the values in the variables should now be sorted from smallest to largest in the order that the variables were passed to the function. This means that the variable of the first pointer will hold the smallest value, and that the variable of the third pointer will hold the largest after the function is called. The main method should ask the user for three numbers, call this function, and print out the three numbers from smallest to largest (on one line with one space between each number) regardless of the order of the numbers entered by the user. To make this precise: If the variables to hold the users three numbers are, in order a, b, and c then use printf("%d %d %d\n", a, b, c); to print out the values in those variables.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
100%
This short program is using basci C instructions
Expert Solution
Step 1
#include <stdio.h>
void tripleorder(int *a, int *b, int *c)
{
int temp;
if (*a > *b) // if a is greater than b, swap them
{
temp = *a;
*a = *b;
*b = temp;
}
if (*a > *c) // if a is greater than c, swap them
{
temp = *a;
*a = *c;
*c = temp;
}
if (*b > *c) // if b is greater than c, swap them
{
temp = *b;
*b = *c;
*c = temp;
Step by step
Solved in 2 steps
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY