How to resolve the algorithm Descending primes step by step in the EasyLang programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Descending primes step by step in the EasyLang programming language
Table of Contents
Problem Statement
Generate and show all primes with strictly descending decimal digits.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Descending primes step by step in the EasyLang programming language
Source code in the easylang programming language
func isprim num .
if num < 2
return 0
.
i = 2
while i <= sqrt num
if num mod i = 0
return 0
.
i += 1
.
return 1
.
proc nextdesc n . .
if isprim n = 1
write n & " "
.
if n > 987654321
return
.
for d = n mod 10 - 1 downto 1
nextdesc n * 10 + d
.
.
for i = 9 downto 1
nextdesc i
.
You may also check:How to resolve the algorithm Environment variables step by step in the Ursa programming language
You may also check:How to resolve the algorithm Primality by Wilson's theorem step by step in the RPL programming language
You may also check:How to resolve the algorithm Sort an outline at every level step by step in the Go programming language
You may also check:How to resolve the algorithm Input loop step by step in the ALGOL W programming language
You may also check:How to resolve the algorithm OpenGL step by step in the QB64 programming language