Răspuns :
#include <iostream>
using namespace std;
int main()
{ int n=3;
int a[50];
int min,max;
int aux;
int diferenta;
for(int i=1;i<=n;i++)
{ cout<<"a["<<i<<"]=";
cin>>a[i];
}
for(int i=1; i<=n-1; i++)
for(int j=i+1; j<=n; j++)
if( a[i] > a[j] )
{
aux = a[i];
a[i] = a[j];
a[j] = aux;
}
max=a[3];
min=a[1];
diferenta=max-min;
cout<<"diferenta dintre min si max: "<<diferenta;
return 0;}
using namespace std;
int main()
{ int n=3;
int a[50];
int min,max;
int aux;
int diferenta;
for(int i=1;i<=n;i++)
{ cout<<"a["<<i<<"]=";
cin>>a[i];
}
for(int i=1; i<=n-1; i++)
for(int j=i+1; j<=n; j++)
if( a[i] > a[j] )
{
aux = a[i];
a[i] = a[j];
a[j] = aux;
}
max=a[3];
min=a[1];
diferenta=max-min;
cout<<"diferenta dintre min si max: "<<diferenta;
return 0;}
#include <iostream>
using namespace std;
int main(){
int a, b, c, min, max, dif;
cin>>a>>b>>c;
min=max=a;
if(b>max)max=b;
if(c>max)max=c;
if(b<min)min=b;
if(c<min)min=c;
dif = max-min;
cout<<dif;
}
using namespace std;
int main(){
int a, b, c, min, max, dif;
cin>>a>>b>>c;
min=max=a;
if(b>max)max=b;
if(c>max)max=c;
if(b<min)min=b;
if(c<min)min=c;
dif = max-min;
cout<<dif;
}