Algoritmo

Páginas: 2 (421 palabras) Publicado: 30 de octubre de 2012
GENERAR UN PROGRAMA QUE DE LA SUMA, LA RESTA, LA MULTIPLICACION Y LA DIVICION DE 2 NUMEROS CUALES QUIERA.
ALGORITMO PRINCIPAL:
1) a[2], r[4]
2) captura(a,r)
3) suma(a,r)
4)resta(a,r)
5) producto(a,r)
6) división(a,r)
7) mostrar(a,r)
8) fin
METODOS:
*captura(a[])
1) c 0, f 0
2) repite mientras c<1
a)”Captura un valor”; a[f0,c0]
b) cc+1
c) “Captura otro valor”; a[f0,c1]
d) regresa paso 2
3) fin

*suma(a,r)
1) x 0, y 0
2) r[x,y] a[0,0]+a[0,1]
3) fin

*resta(a,r)
1) x 0, y 1
2) r[x,y]a[0,0]-a[0,1]
3) fin

*producto(a,r)
1) x 0, y 2
2) r[x,y] a[0,0]*a[0,1]
3) fin

*división(a,r)
1) x 0, y 3
2) r[x,y] a[0,0]/a[0,1]
3) fin*mostrar(a,r)
1) c 0
2) Repite mientras c<=3
a)”mostrar”;r[c]
b) c c+1
c) regresa paso 2
3) fin

#include <iostream.h>
#include <stdio.h>
#include <conio.h>#include <string.h>

Void captura(float a[]);
Void suma(float a, float b);
Void resta(float a, float b);
Void producto(float a, float b);
Void division(float a, float b);
Void mostrar(float a,float r);

Void main(void){
Clrscr();
float a[2],r[4];
captura(a,r);
suma(a,r);
resta(a,r);
producto(a,r);
división(a,r);
mostrar(a,r);
getche();
}
Void captura(float a[]){
Intc=0,f=0;
For (c=0;c<1;c++){
Printf(“CAPTURA UN NUMERO:%d:”;
Scantf(“%f”,&a[f0,c0]);
Printf(“CAPTURA OTRO NUMERO:%d:”;
Scantf(“%f”,&a[f0,c1]);
}
}

Voidsuma(float a, float b){
Int x 0,y 0;
r[x,y] a[0,0]+a[0,1]
}

Void resta(float a, float b){
Int x 0,y 0;
r[x,y] a[0,0]-a[0,1];
}

Void producto(float a, float b){
Int x0,y 0;
r[x,y] a[0,0]*a[0,1];
}

Void division(float a, float b){
Int x 0,y 0;
r[x,y] a[0,0]/a[0,1];
}

Void mostrar(float a, float r){
Int c=0,;
For (c=0;c<3;c++){...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Algoritmo
  • Algoritmo
  • Algoritmos
  • Algoritmos
  • Algoritmos
  • Algoritmos
  • Algoritmos
  • Algoritmos

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS