program to check whether a number is automorphic or not in Qbasic using While - Wend loop
Answers
Answered by
0
Answer: r/t(rabbit and tortoise)
Explanation: We use the rabbit and tortoise method of solving automorphic or recurring numbers. This method ensures that you don't get wrong outputs when you input a value and you don't run out of memory. Thanks for reading, bro.
Answered by
2
Answer:
CLS
INPUT "ENTER A NUMBER:", N
C = 0
COPY = N
WHILE COPY > 0
C = C + 1
COPY = COPY \ 10
WEND
SQ = N * N
K = 10 ^ C
P = SQ MOD K
IF P = N THEN PRINT "IT IS AN AUTOMORPHIC NUMBER" ELSE PRINT "NOT AN AUTOMORPHIC NUMBER"
END
Hope it helps :)
Similar questions