lunes, 14 de marzo de 2016

EXAMEN- TECNOLOGIA 14/03/16



// Example program
#include <iostream>
#include <string>
using namespace std;
int main()
{
  int n1,n2,n3;
  cout<<"what is the first number?";
  cin>>n1;
  cout<<"what is the second number?";
  cin>>n2;
  cout<<"what is the third number?";
  cin>>n3;
 
  if((n1>n2)&&(n2>n3)){
  cout<<n1<<endl;
  cout<<n2<<endl;
  cout<<n3<<endl;
  }
 
else
if((n1>n2)&&(n2<n3)&&(n1>n3)){
cout<<n1<<endl;
cout<<n3<<endl;
cout<<n2<<endl;
}

else
if((n1<n2)&&(n2>n3)&&(n1>n3)){
cout<<n2<<endl;
cout<<n1<<endl;
cout<<n3<<endl;
}
else
if((n1>n2)&&(n2>n3)&&(n1<n3)){
cout<<n3<<endl;
cout<<n1<<endl;
cout<<n2<<endl;
}

else
if((n1>n2)&&(n2<n3)&&(n1<n3)){
cout<<n3<<endl;
cout<<n1<<endl;
cout<<n2<<endl;
}

else
if((n1<n2)&&(n2<n3)&&(n1<n3)){
cout<<n3<<endl;
cout<<n2<<endl;
cout<<n1<<endl;
}
}




·         what is the first number?100
·         what is the second number?80
·         what is the third number?10
100
80
10

No hay comentarios:

Publicar un comentario