Tic2, Integradora etapa 1
Enviado por Andrea.110 • 25 de Septiembre de 2018 • Trabajo • 368 Palabras (2 Páginas) • 94 Visitas
Página 1 de 2
[pic 1][pic 2]
- Do the algorithm and flowchart which print the series of numbers from 1 to 10 and also when it finished, print its respective sum.[pic 3]
- Start
- Print series from 1 to 10 and its addition at the end
- Initialize the accumulating variable of numbers in zero
- Verify the numbers of the serie (the number is less than or equal to 10) then,
- Yes: Print its respective sum
- No: Add the 1 to the accumulating variable of the number N= N + 1, go to step 4
- End
[pic 4][pic 5][pic 6][pic 7][pic 8][pic 9][pic 10][pic 11][pic 12][pic 13][pic 14][pic 15][pic 16][pic 17][pic 18][pic 19][pic 20][pic 21][pic 22][pic 23][pic 24][pic 25][pic 26]
b) Do the algorithm and flowchart that calculate and print the Factorial of a number.
- Start
- Capture the number (n)
- Identify if the number is equal to zero.
- True: its factorial is 1.
- False: factorial is 1.
- Initialize the accumulator variable in 1 (a = 1).
- Take the new value of the factorial, calculating the factorial that you have by the accumulator variable (F = f * a).
- Add one to the accumulator variable and verify that the result is less than or equal to the number that was chosen (n).
- Perform the same operations as point 7 but now with the new accumulator variable.
- Add 1 to the accumulator variable and verify that it is equal to the same number multiplied by 1 (a = a * 1).
- Make point 9.
- Perform the same procedures from point 8.
- If the accumulator variable is greater than the number that was chosen (n), the factorial of the number that opted was found.
- Print the factorial
- End.[pic 27]
[pic 28]
[pic 29][pic 30][pic 31][pic 32][pic 33][pic 34][pic 35][pic 36][pic 37][pic 38][pic 39][pic 40][pic 41][pic 42][pic 43][pic 44][pic 45][pic 46][pic 47][pic 48][pic 49][pic 50][pic 51][pic 52][pic 53][pic 54]
...
Disponible sólo en Clubensayos.com