Está en la página 1de 6

DEZARROLAR UN ALGORITMO EN LA CUAL DETERMINE SI UN NUMERO ENTERO ES

POSITIVO, NEGATIVO O NEUTRO.


#include<iostream.h>
int main ()
{
int a;
cout<<"ingrese numero :";
cin>>a;
if(a==0)
{
cout<<"el numero ingresado es nulo :",a;
}
if(a<0)
{
cout<<"el numero ingresado es negativo :",a;
}
if(a>0)
{
cout<<"el numero ingresado es positivo :",a;
}
}
DESARROLLAR UN ALGORITMO EN LA CUAL DADO TRES NÚMEROS DEVOLVER LOS
NÚMEROS EN FORMA ASCENDENTE
# include<iostream.h>

void main()

int i,j,n[3],AUX;

cout<<"ingrese a:";

cin>> n[1];
cin>> n[2];

cin>> n[3];

for (i=0;i<3;i++)

for (j=0;j<3;j++)

if(n[j]>n[j+1])

AUX=n[j];

n[j]=n[j+1];

n[j+1]=AUX;

cout<<" la ascendencia es"<<n[1]<<"\n";

cout<<" la ascendencia es"<<n[2]<<"\n";

cout<<" la ascendencia es"<<n[3]<<"\n";

UTILIZANDO COUT
#include<iostream.h>
void main()
{
int a,b,c,may,inter,menor;
cout<<"ingrese numero:";
cin>>a;
cin>>b;
cin>>c;
if(a>b && a>c)
{
may=a;
}
else
if(b>a && b>c)
{
may=b;
}
else
may=c;

if(a<b && a<c)


{
menor=a;
}
else
if(b<a && b<c)
{
menor=b;
}
else
{
menor=c;

}
{
inter =(a+b+c)-(may+menor);
}

cout<<"el numero es:"<<menor<<"\n";


cout<<"el numero es:"<<inter<<"\n";
cout<<"el numero es:"<<may<<"\n";
}
DEZARROLAR UN ALGORITMO QUE RESUELVA UNA ECUACIONDE PRIMER GRADO
AX+b=0

#include<iostream.h>

void main()

int a,b,x;

cout<<"ingrese numero:";

cin>> a;

cout<<"ingrese numero:";

cin>> b;

x=-(b/a);

cout<<"la ecuacion de primer grado es:"<<x<<"\n";

DESARROLLAR UN ALGORITMO QUE CALCULE EL TOTAL DE PAGAR POR LA COMPRA DE


CAMISAS, SI SE COMPRA 3 CAMISAS O MÁS SE APLICA UN DESCUENTO DEL 20% SOBRE EL
TOTAL DE LA COMPRA Y SI SON MENOS DE 3 CAMISAS UN DESCUENTO DEL 10%

#include<iostream.h>

void main ()

int C,V,D,T,N;

cout<<"ingrese numero de camisas:";

cin>>C;
cout<<"ingrese costo de camisas:";

cin>>V;

T=C*V;

cout<<"valor de venta:"<<T<<"\n";

if (C-2)

D=T*0.20;

cout<<"descuento10%:"<<D<<"\n";

else

if(C<3)

D=T*0.10;

cout<<"descuento 10%:"<<D<<"\n";

N=T-D;

cout<<"pagar :"<<N<<"\n";

DESARROLLAR UN ALGORITMO EN LA CUAL DADO UN NUMERO, DEVOLVER EL


DOBLE SI EL NUMERO NO ES PAR, CASO CONTRARIO EL TRIPLE
#include<iostream.h>
void main()
{
int a,r;
cout<<"ingrese numero:";
cin>> a;
if (a%2==0)
{
r=a*3;
}
else
{
r=a*2;
}
cout<<" el resultado es:"<<r<<"\n";
}

También podría gustarte