#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
float b1,b2,h,area;
//float base_mayor,base_menor,
// altura,area;
cout<<"base menor=";cin>>b1;
cout<<"base mayor=";cin>>b2;
cout<<"altura=";cin>>h;
area=0.5*(b1+b2)*h; // 1/2 no es 0.5
cout<<"area="<<area<<endl;
system("PAUSE");
}
#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;
int main(){
float a,b,c;
cout<<"cateto 1:";cin>>a;
cout<<"cateto 2:";cin>>b;
c=sqrt(a*a+b*b);
cout<<"c="<<c<<endl;
system("PAUSE");
}
#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
float x1,x2,y1,y2,m;
cout<<"(x1,y1):";cin>>x1>>y1;
cout<<"(x2,y2):";cin>>x2>>y2;
m = (y1-y2)/(x1-x2);
cout<<"m="<<m<<endl;
system("PAUSE");
}
#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
int hora, minuto;
cout<<"hora (0-23):"; cin>>hora;
cout<<"minutos (0-59):"; cin>>minuto;
if (hora>12){
hora=hora-12;
cout<<hora<<":"<<minuto<<" PM\n";
} else {
cout<<hora<<":"<<minuto<<" AM\n";
}
system("PAUSE");
}
#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
int n1,n2,suma,resto;
cout<<"numero 1: ";cin>>n1;
cout<<"numero 2:";cin>>n2;
suma=n1+n2;
resto=suma%5;
if(resto){
cout<<"La suma no es multiplo de 5\n";
} else{
cout<<"La suma si es multiplo de 5\n";
}
system("PAUSE");
}
No hay comentarios:
Publicar un comentario