Julia Tutorial For Beginners program to print range of prime number
What is prime number?
By any other number the prime number cannot be divided and if we try to divide the prime number
A prime number definition is a number which is divided by itself and one is called as prime number . by any other number between one and the prime number it will not give remainder as zero
Here we write a small program in Julia to print range of prime number. .Julia Program to Print all Prime Numbers in a Interval
Julia Program to Print all Prime Numbers in a Interval
What is prime number?
By any other number the prime number cannot be divided and if we try to divide the prime number
A prime number definition is a number which is divided by itself and one is called as prime number . by any other number between one and the prime number it will not give remainder as zero
Here we write a small program in Julia to print range of prime number. .Julia Program to Print all Prime Numbers in a Interval
When we execute the above program we get the list of prime numbers as below. Here we will pass a parameter in the method and it will print the prime number starting from one to the range specified
function primeNumberRange(number)
for k=0:number
count =0
for j = 1:k
if k%j == 0
count=count+1
println(k, " % ",j , " = ", number%j)
end
end
if(count == 2)
println(k ,": is a prime number")
else
println(k ,": is not a prime number")
end
end
end
Comments
Post a Comment