please forward the function to calculate the smallest and largest without using (if,while else) statements
Input three different integers: 13 27 14
Sum Average Product Smallest Largest
54 18 4914 13
#include<iostream>
using namespace std;
int main()
{
int x,y,z;
cin>>x>>y>>z;
cout<<"the sum is ="<<x+y+z<<endl;
cout<<" average is ="<<(x+y+z)/3<<endl;
cout<<" Product is ="<<x*y*z<<endl;
cout<<" smallest is="<<
return 0;
}
Recommended Answers
Jump to PostMake some attempt. What you have displayed shows only the most minimal effort.
Jump to PostIf you're not allowed to use if/else, are you allowed to use the ternary operator "? :" If so, check it out. If not, I can't think of a way offhand that doesn't use if.
All 8 Replies
jonsca
1,059
Quantitative Phrenologist
Team Colleague
Featured Poster
taumang
-10
Light Poster
taumang
-10
Light Poster
jonsca
1,059
Quantitative Phrenologist
Team Colleague
Featured Poster
taumang
-10
Light Poster
Chilton
22
Junior Poster
Tamlyn
0
Newbie Poster
madifemo
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.