09.05.2013 Views

Diagrama de flujos

Diagrama de flujos

Diagrama de flujos

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Suma dos<br />

Números<br />

#inclu<strong>de</strong> <br />

int a, b,c;<br />

main()<br />

{<br />

a=5;<br />

b=4;<br />

c=a+b;<br />

printf(“c es igual a<br />

%d”, c);<br />

getchar();<br />

}<br />

<strong>Diagrama</strong> <strong>de</strong> <strong>flujos</strong>:<br />

Seudocódigo:<br />

1.- I<strong>de</strong>ntificar tres variables<br />

2.-Sumar dos <strong>de</strong> ellas y la tercera es como resultado.<br />

3.- Imprimir la tercera<br />

Inicio<br />

a, b, c<br />

A+b=c<br />

C<br />

Fin


Resta dos números<br />

#inclu<strong>de</strong> <br />

int a, b,c;<br />

main()<br />

{<br />

a=5;<br />

b=4;<br />

c=a-b;<br />

printf(“c es igual a %d”, c);<br />

getchar();<br />

}<br />

<strong>Diagrama</strong> <strong>de</strong> <strong>flujos</strong>:<br />

Seudocódigo:<br />

1.- I<strong>de</strong>ntificar tres variables<br />

2.-Restar dos <strong>de</strong> ellas y la tercera es como resultado.<br />

3.- Imprimir la tercera<br />

Inicio<br />

a, b, c<br />

a-b=c<br />

C<br />

Fin


Compara cuál <strong>de</strong> los<br />

dos números es mayor<br />

#inclu<strong>de</strong> <br />

#inclu<strong>de</strong> <br />

int x,y;<br />

main()<br />

{<br />

x=6;<br />

y=4;<br />

if (x>y)<br />

printf(“x es mayor”);<br />

else<br />

printf(“x es menor);<br />

getch();<br />

return 0;<br />

}<br />

<strong>Diagrama</strong> <strong>de</strong> <strong>flujos</strong>:<br />

Seudocódigo:<br />

1.- I<strong>de</strong>ntificar dos variables (x,y)<br />

2.-Ponerles un valor y resolver cuál <strong>de</strong> las dos es mayor<br />

3.- Imprimir si x es mayor o menor<br />

Inicio<br />

x>y<br />

X es mayor X es menor<br />

Fin


Compara tres números<br />

uno <strong>de</strong> ellos es 5, verifica<br />

que el resto es diferente<br />

sino<br />

imprime “hay alguno<br />

igual”<br />

#inclu<strong>de</strong> <br />

#inclu<strong>de</strong> <br />

int a, b, c;<br />

main()<br />

{<br />

a=5;<br />

b=6 ó 5 si quieren que<br />

sea igual;<br />

c=2;<br />

if ((b!=a)&&(c!=a))<br />

printf(“todos los<br />

numeros son<br />

diferentes”);<br />

else<br />

printf(“hay uno igual”);<br />

getch();<br />

return 0;<br />

}<br />

Seudocódigo:<br />

1.- I<strong>de</strong>ntificar tres números, uno <strong>de</strong> ellos es 5.<br />

2.-Comparar si hay números iguales o no.<br />

3.- Imprimir “todos los números son diferentes “si son diferentes o<br />

“hay uno igual” si dos son iguales.


<strong>Diagrama</strong> <strong>de</strong> <strong>flujos</strong>:<br />

Inicio<br />

a=5, b, c<br />

a=b! y c!=a<br />

X es mayor X es menor<br />

Fin


Imprimir números <strong>de</strong>l 1<br />

al 7<br />

#inclu<strong>de</strong> <br />

#inclu<strong>de</strong> <br />

int i, j, dato;<br />

main()<br />

{<br />

printf(“ciclos\n”);<br />

for(i=5;i


Imprime números <strong>de</strong>l 5<br />

al cero.<br />

#inclu<strong>de</strong> <br />

#inclu<strong>de</strong> <br />

int i, j, dato;<br />

main()<br />

{<br />

printf(“ciclos\n”);<br />

for(i=-1;i>5;i--)<br />

printf(“\ncontando: %d”,<br />

I);<br />

printf(“\ntermino <strong>de</strong><br />

contar”);<br />

getch();<br />

return 0;<br />

}<br />

Seudocódigo:<br />

1.- Sólo imprimir <strong>de</strong>l 5 al 0<br />

Contando i<br />

Inicio<br />

i=5; i>-1;<br />

i--;<br />

Fin

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!