Computer science assignment help

computer science

Description

#include <stdlib.h>
#include <stdio.h>
void memAdd(int *, int *, int *);
int main(){
int smallestNum =5;
int middelNum =20;
int largestNum =1;
memAdd(&smallestNum, &middelNum, &largestNum);
printf("Smallest Number: %d",smallestNum);
printf("\nMiddle Number: %d",middelNum);
printf("\nLargest Number: %d",largestNum);
return 0;
}
void memAdd(int *smallestNum, int *middelNum, int *largestNum){
int largest =*smallestNum;
int smallest =*smallestNum;
int middleNum =*smallestNum;
if (*middelNum > largest){
largest = *middelNum;
}
if (*largestNum > largest) {
largest = *largestNum;
}
if (*middelNum < smallest) {
smallest = *middelNum;
}
if (*largestNum < smallest) {
smallest = *largestNum;
}
if( smallest< *middelNum && largest > *middelNum){
middleNum =*middelNum;
}
if( smallest< *smallestNum && largest > *smallestNum){
middleNum =*smallestNum;
}
if( smallest < *largestNum && largest > *largestNum){
middleNum =*largestNum;
}
//assign back
*smallestNum =smallest;
*largestNum =largest;
*middelNum =middleNum;

Instruction Files

Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.