Programacion Basica
-
Upload
esmer-cruz-sanchez -
Category
Documents
-
view
222 -
download
2
description
Transcript of Programacion Basica
-
1
UNIDAD 2,3,4 FUNDAMENTOS DE LENGUAJE
MATERIA: PROGRAMACION BASICA
CARRERA: INGENIERIA MECATRONICA
CATEDRTICO: LUCIA SANCHEZ VASQUEZ
ALUMNA: EDITH ESMERALDA CRUZ SANCHEZ
LUGAR Y FECHA: HEROICA CIUDAD DE TLAXIACO, CARRETERA A
PUTLA, LLANO YOSOBE KM 56. 04 DE JUNIO
-
2
LISTA DE PROGRAMAS REALIZADOS DEV C++
1. REA DE UN TRIANGULO
#include
using namespace std;
int main ()
{
float a, b, c=0;
cout> a;
cout> b;
c=(a*b)/2 ;
cout
-
3
2. SUMA DE DOS NMEROS
#include
using namespace std;
/* programa para la suma de dos numeros */
int main()
{
int b,a,s=0;
couta;
coutb;
s=a+b;
cout
-
4
3. CALCULAR LA DISTANCIA DE UN AUTOMVIL
#include
using namespace std;
int main ()
{
float d=0, v, t;
cout> v;
cout> t;
d=v*t;
cout
-
5
4. PROMEDIO DE 3 NUMEROS
/*programa que solicite 3 numeros y muestre el valor */
#include
using namespace std;
int main()
{
float b,a, c, p;
couta;
coutb;
coutc;
p= (a+b+c)/3;
cout
-
6
5. ERES MAYOR O MENOR DE EDAD
#include
using namespace std;
int main()
{
int edad;
coutedad;
if(edad>=18)
cout
-
7
6. SOLICITAR UNA CALIFICACION Y ASIGNAR UNA LETRA DE 8-10
A, 7-8 B, 6-7 C Y 0-6 CALIF. NO ACEPTADA.
#include
using namespace std;
int main ()
{ float a;
couta;
if (a8)
cout
-
8
7. EL NUMERO ES PAR O IMPAR
#include
using namespace std;
int main ()
{
int a;
couta;
if (a%2==0)
cout
-
9
8. QUIEN DE LOS DOS ES MAYOR?
#include
using namespace std;
int main()
{
int a,b,c;
couta;
coutb;
if (a>b)
{
c=a-b;
cout
-
10
{
c=b-a;
cout
-
11
9. SUMA DE 10 NUMEROS
#include
using namespace std;
int main ()
{
int a=1, n, suma=0;
cout
-
12
10. GENERAR Y MOSTRAR LOS PRIMEROS 50 NUMEROS PARES
#include
using namespace std;
int main ()
{
int a=1;
cout
-
13
11. PIDA EL NUMERO DE DATOS Y MUESTRE LA SUMA DE LOS
NUMEROS PARES.
#include
using namespace std;
int main ()
{
int num,cont=1,suma=0,n;
coutnum;
while (cont
-
14
12. CALCULAR EL FACTORIAL DE UN NUMERO
#include
using namespace std;
int main ()
{
int n, fac=1;
coutn;
while(n!=0)
{
fac=fac*n;
n--;
}
cout
-
15
13. CALCULAR EL FIBONACCI DE UN NUMERO
#include
using namespace std;
int main ()
{
int suma=1,n,a=0,b=1;
coutn;
cout
-
16
14. PIDE 10 NUMEROS Y SUMA LOS IMPARES
#include
using namespace std;
int main ()
{
int num=10,cont=1,suma=0,n;
while (cont
-
17
15. MUESTRE SI EL NMERO ES PRIMO
#include
using namespace std;
int main(){
int a=0,i,n;
cout
-
18
16. SUMA DE LOS 100 PRIMEROS NUMEROS
#include
using namespace std;
int main ()
{
int a=1,s=0;
cout
-
19
17. QUE SUME LOS PARES Y MULTIPLIQUE LOS IMPARES
#include
using namespace std;
int main()
{
int n,a,q=1,p=0;
cout
-
20
18. Intercambie el valor de 2 variables, solo si el primero es mayor
#include
using namespace std;
int main()
{
int a,b,c=0;
couta;
coutb;
if (a>b)
{
c=a+c;
a=b;
b=c;
cout
-
21
else
{
cout
-
22
19. QUE VISUALICE LA TABLA DE MULTIPLICAR 1-10
#include
using namespace std;
int main ()
{
int n, c=1, a=1;
coutn;
while(c
-
23
20. MUESTRE DEL 1 AL 10
#include
using namespace std;
main ()
{
int a=1;
while (a
-
24
int suma=0,n=1;
while (n
-
25
{
int edad;
coutedad;
if(edad>=18)
cout
-
26
23. CUADRADO DE UN NUMERO (POW)
#include
#include
using namespace std;
main ()
{
int a, b;
cout > a;
b= pow (a,2);
cout
-
27
24. SON DIVISIBLES LOS NUMEROS
#include
using namespace std;
main()
{
int a,b;
couta;
coutb;
if (a%b == 0 )
cout
-
28
25. DATOS PERSONALES
#include
using namespace std;
main ()
{
string nombre , sexo, a, b, calle, colonia, municipio, estado, edad,
telefono , cp ;
cout> nombre;
cout> a;
cout> b;
cout> edad;
cout
-
29
cin >>sexo;
cout calle;
cout> colonia;
cout> municipio;
cout> estado;
cout> cp;
cout>telefono;
cout
-
30
26. CONTORNO DE UN CUADRADO CON *
#include
using namespace std;
int main ()
{
cout
-
31
b= a*a;
cout
-
32
29. EL CARCTER INTRODUCIDO ES VOCAL
#include
using namespace std;
int main()
{
char letra;
cout
-
33
cout
-
34
int a, b,c;
cout
-
35
31. MEN DEL 1-5 QUE DIGA EL NOMBRE DEL NUMERO
#include
using namespace std;
main ()
{
char a;
cout
-
36
break;
case '4':
cout
-
37
{
int a, b,c;
couta;
coutb;
coutc;
if (a==b and a==c)
cout=c)
cout
-
38
33. CALIFICACION DE ACUERDO A LA NOTA ASIGNADA
#include
using namespace std;
main ()
{
char nota;
cout
-
39
case '4':
cout
-
40
suma=suma+a;
a++;
}
cout
-
41
a++;
}
cout
-
42
}
}
37. MENU CON OPERACIONES BASICAS
#include
using namespace std;
main()
{
float a,b,c;
int p;
cout
-
43
cin>>p;
switch(p)
{
case 1:
couta;
coutb;
c=a+b;
cout
-
44
case 4:
couta;
coutb;
c=a/b;
cout
-
45
-
46
38. TRIANGULO DE *
#include
using namespace std;
int main ()
{
int a;
couta;
for (int i=1;i
-
47
39. TRIANGULO INVERTIDO DE *
#include
using namespace std;
int main()
{
int a;
couta;
for (int i=a;i>=1;i--)
{
for (int k=1;k
-
48
40. MUESTRA HOLA 10 VECES
#include
using namespace std;
int main()
{
for(int i=0; i
-
49
}
}
42. MULTIPLOS DE 5
#include
using namespace std;
int main ()
{
int a=1;
cout
-
50
}
}
43. CALCULO DE LA MEDIA ARITMETICA
#include
using namespace std;
int main ()
{
float b,contador=-1,suma=0;
char f;
cout
-
51
suma=b+suma;
}
cout
-
52
for (k=1;k
-
53
couta;
if(a0)
d=d+1;
else
e=e+1;
}
cout