100 002
Assignments Done
98.3%
Successfully Done
In June 2021

# Answer to Question #19208 in C++ for MK

Question #19208
write a program that ask the user to insert 3 ingers numbers between 1-100 and display the following menu
a-display maximum
b-display minimum
1
2012-11-22T09:44:34-0500
int Maximum();
int Minimum();
int arrayofnumbers[3];
int main()
{
char ch=' ';
for(int i=0;i<3;i++){
printf("Enter number %d: ",i+1);
scanf("%d",&arrayofnumbers[i]);
}

printf("a-display maximum
");
printf("b-display minimum
");
ch=getchar();
ch=getchar();
if(ch=='a'){
printf("Maximum= %d",Maximum());
}
if(ch=='b'){
printf("Minimum= %d",Minimum());
}

int k;
scanf("%d",&k);
return 0;
}

int Maximum() {
int max=arrayofnumbers[0];
for(int i=0;i<3;i++){
if(arrayofnumbers[i]>max){
max=arrayofnumbers[i];
}
}
return max;
}

int Minimum() {
int min=arrayofnumbers[0];
for(int i=0;i<3;i++){
if(arrayofnumbers[i]<min){
min=arrayofnumbers[i];
}
}
return min;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!