Me ajudem por favor com um algoritmo de fatorial no visualg?

como faço tipo um jogo de sinal (+ com - = - etc...) dentro do comando enquanto

sendo fatorial a operaçao ex: 5!=5x4x3x2x1 = 120

com o jogo de sinal ficaria (se en questao fosse o numero -5!= -5x-4x-3x-2x-1 = -120)

e como segundo exemplo: -4!= 24 POSITIVO

estrutura que fiz sem o jogo de sinal:

ALGORITMO"FATORIAL"

NUM:REAL

CONT:REAL

CONT2,T:REAL

inicio

ESCREVAL ("INSIRA UM NUMERO")

LEIA (NUM)

T <- NUM

CONT2 <- NUM -1

CONT <- 1

ENQUANTO (CONT < CONT2) FACA

CONT <- CONT+1

NUM <- CONT*NUM

FIMENQUANTO

ESCREVAL ("O FATORIAL DE ",T, " É:")

ESCREVAL (NUM)

fimalgoritmo

por favor me ajudem a resolver isso --*

10 pts

Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Helpful Social

Copyright © 2024 QUIZLS.COM - All rights reserved.