Hola

Páginas: 7 (1503 palabras) Publicado: 29 de septiembre de 2010
Colegio San Agustín
Cochabamba – Bolivia

COMPUTACIÓN

Nombre: Ilsen Noriega Arze

Curso: Cuarto ‘B’

Profesor: Rory Rodriguez

05, Abril de 2010

1. Leer 5 valores, promediar.
#include<stdio.h>
#include<stdlib.h>
#include<iostream.h>
#include<conio.h>
main()
{clrscr();
float A,B,C,D,E,x,P;
cout<<”introduce 5 valores”;cin>>A>>B>>C>>D>>E;
x=A+B+C+D+E;
P=x/5;
cout<<”El promedio de “<<A<<B<<<<C<<D<<E<<”es ”<<P;
getch();
}

2. Leer 1 valor, indicar si es positivo, negativo o cero.
#include<stdio.h>
#include<stdlib.h>
#include<iostream.h>
#include<conio.h>
main()
{clrscr();
int v;cout<<”introduce un valor”; cin>>v;
if (v<0) cout<<”es negativo”;
else if (v>0) cout<<”es positivo”;
else cout<<”es cero”;
getch();
}

3. Leer 3 valores, ordenarlos descendentemente.
#include<stdio.h>
#include<stdlib.h>
#include<iostream.h>
#include<conio.h>
main()
{clrscr();
int A,B,C;
cout<<”introduce 3 valores”;cin>>A>>B>>C;
if((A>B)&&(B>C)) cout<<”A,B,C”;
else if((A>C)&&(C>B)) cout<<”A,C,B”;
else if((B>A)&&(A>C)) cout<<”B,A,C”;
else if((B>C)&&(C>A)) cout<<”B,C,A”;
else if((C>A)&&(A>B)) cout<<”C,A,B”;
else if((C>B)&&(B>A)) cout<<”C,B,A”;
getch();
}

4. Leer 1 valor, sumarsus dígitos.
#include<stdio.h>
#include<stdlib.h>
#include<iostream.h>
#include<conio.h>
main()
{clrscr();
int s=0,p,r,v,s;
cout<<”introduce un valor”; cin>>v;
while(v>0)
{
p= v / 10;
r= v % 10;
s=s +r;
v=p;
}
cout<<s;
getch();
}

5. Leer n valores promediar aquellos que son positivos, contar aquellos que pares.#include<stdio.h>
#include<stdlib.h>
#include<iostream.h>
#include<conio.h>
main()
{clrscr();
int c,sp,pp,cp,n,v;
cout<<”introduce n; cin>>n;
sp=0;cp=0;
for(c=0;c<=n;c++)
{cout<<”introduce un valor”<<endl;cin>>v;
if (v>0) sp=sp+v;
if ((v mod 2)=0) cp=cp+1;
}
pp=sp div n;
cout<<”el promedio de los positivos es:”<<pp<<endl;
cout<< ”el numero de pares es: ”<<cp<<endl;
getch();
}

6. Generar 1000 valores (desde 1 hasta 1000 imprimir aquellos que son perfectos.
#include<stdio.h>
#include<stdlib.h>
#include<iostream.h>
#include<conio.h>
main()
{clrscr();
int c,v,n,s,c2;
v=1;
for(c=1;c<=1000;c++)
{ s=0,c2;
for(c2=1;c2<v;c2++)
{if((v%c2)==0) s=s+c2;}
if (s==v) cout <<v;
v=v+1;
getch();
}

7.
1
22
333
4444
55555
#include<stdio.h>
#include<stdlib.h>
#include<iostream.h>
#include<conio.h>
main()
{clrscr();
int a=1,b=1;
while(a<=5)
{while (b<=a)
{ cout<<b;}
a=a+1;
b=b+1;
}
getch();
}

8.
54321
5432
543
54
5
#include<stdio.h>#include<stdlib.h>
#include<iostream.h>
#include<conio.h>
main()
{clrscr();
int con=5,n;
do
{{
n=5;
cout<<con;
n--;}
while (n<=con)}
con--;}
while(con>=1)
getch();
}

9. Construir la tabla de multiplicar (1-10)
#include<stdio.h>
#include<stdlib.h>
#include<iostream.h>
#include<conio.h>
main()
{clrscr();
int v,c=1,m=0,n;
for(c=1;c<=10; c++)
{
for(n=1; n<=10; n++)
{ m=c*n;
cout<<c<<”*”<<n<<”=”<<m;}
}
getch();
}

10. Cargar datos en un vector de tamaño 20 imprimir
a) mayor valor
b) menor valor
c) promedio
#include<stdio.h>
#include<stdlib.h>
#include<iostream.h>
#include<conio.h>
main()
{clrscr();
int c,s=0,v[20],ma=-1234,me=1234,pv;...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • hola hola hola hola
  • hola hola hola hola hola
  • hola hola hhola hola y hola
  • hola hola hola
  • Hola Hola Hola
  • Hola Hola Hola
  • hola hola hola
  • Hola hola

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS