# Check if a number is full prime number

Here given code implementation process.

``````// C Program
// Check if a number is full prime number
#include <stdio.h>

int isPrime(int n)
{
if (n <= 1)
{
return 0;
}
//Base case
if (n == 2 || n == 3 || n == 5)
{
return 1;
}
// Check divisibility of a number
for (int i = n / 2; i > 1; --i)
{
if (n % i == 0)
{
return 0;
}
}
return 1;
}
void isFullPrime(int num)
{
int result = 0;
if (isPrime(num) == 1)
{
result = 1;
int n = num;
int digit = 0;
while (n > 0 && result == 1)
{
digit = n % 10;
if (digit == 2 || digit == 3 ||
digit == 5 || digit == 7)
{
n = n / 10;
}
else
{
// When digit is not prime
result = 0;
}
}
}
if (result == 1)
{
printf("\n %d is full prime number ", num);
}
else
{
printf("\n %d is not full prime number ", num);
}
}
int main()
{
// Test A
// n = 2357
isFullPrime(2357);
// Test B
// n = 231
isFullPrime(231);
return 0;
}``````

#### Output

`````` 2357 is full prime number
231 is not full prime number``````
``````/*
Java Program
Check if a number is full prime number
*/
{
public boolean isPrime(int n)
{
if (n <= 1)
{
return false;
}
//Base case
if (n == 2 || n == 3 || n == 5)
{
return true;
}
// Check divisibility of a number
for (int i = n / 2; i > 1; --i)
{
if (n % i == 0)
{
return false;
}
}
return true;
}
public void isFullPrime(int num)
{
boolean result = false;
if (isPrime(num))
{
result = true;
int n = num;
int digit = 0;
while (n > 0 && result)
{
// Get last digit
digit = n % 10;
if (digit == 2 || digit == 3 ||
digit == 5 || digit == 7)
{
n = n / 10;
}
else
{
// When digit is not prime
result = false;
}
}
}
if (result)
{
System.out.print("\n " + num + " is full prime number ");
}
else
{
System.out.print("\n " + num + " is not full prime number ");
}
}
public static void main(String[] args)
{
// Test A
// n = 2357
// Test B
// n = 231
}
}``````

#### Output

`````` 2357 is full prime number
231 is not full prime number``````
``````// Include header file
#include <iostream>
using namespace std;
/*
C++ Program
Check if a number is full prime number
*/
{
public: bool isPrime(int n)
{
if (n <= 1)
{
return false;
}
//Base case
if (n == 2 || n == 3 || n == 5)
{
return true;
}
// Check divisibility of a number
for (int i = n / 2; i > 1; --i)
{
if (n % i == 0)
{
return false;
}
}
return true;
}
void isFullPrime(int num)
{
bool result = false;
if (this->isPrime(num))
{
result = true;
int n = num;
int digit = 0;
while (n > 0 && result)
{
// Get last digit
digit = n % 10;
if (digit == 2 || digit == 3 ||
digit == 5 || digit == 7)
{
n = n / 10;
}
else
{
// When digit is not prime
result = false;
}
}
}
if (result)
{
cout << "\n " << num
<< " is full prime number ";
}
else
{
cout << "\n " << num
<< " is not full prime number ";
}
}
};
int main()
{
// Test A
// n = 2357
// Test B
// n = 231
return 0;
}``````

#### Output

`````` 2357 is full prime number
231 is not full prime number``````
``````// Include namespace system
using System;
/*
Csharp Program
Check if a number is full prime number
*/
{
public Boolean isPrime(int n)
{
if (n <= 1)
{
return false;
}
//Base case
if (n == 2 || n == 3 || n == 5)
{
return true;
}
// Check divisibility of a number
for (int i = n / 2; i > 1; --i)
{
if (n % i == 0)
{
return false;
}
}
return true;
}
public void isFullPrime(int num)
{
Boolean result = false;
if (this.isPrime(num))
{
result = true;
int n = num;
int digit = 0;
while (n > 0 && result)
{
// Get last digit
digit = n % 10;
if (digit == 2 || digit == 3 ||
digit == 5 || digit == 7)
{
n = n / 10;
}
else
{
// When digit is not prime
result = false;
}
}
}
if (result)
{
Console.Write("\n " + num + " is full prime number ");
}
else
{
Console.Write("\n " + num + " is not full prime number ");
}
}
public static void Main(String[] args)
{
// Test A
// n = 2357
// Test B
// n = 231
}
}``````

#### Output

`````` 2357 is full prime number
231 is not full prime number``````
``````package main
import "fmt"
/*
Go Program
Check if a number is full prime number
*/

func isPrime(n int) bool {
if n <= 1 {
return false
}
//Base case
if n == 2 || n == 3 || n == 5 {
return true
}
// Check divisibility of a number
for i := n / 2 ; i > 1 ; i-- {
if n % i == 0 {
return false
}
}
return true
}
func isFullPrime(num int) {
var result bool = false
if isPrime(num) {
result = true
var n int = num
var digit int = 0
for (n > 0 && result) {
// Get last digit
digit = n % 10
if digit == 2 || digit == 3 ||
digit == 5 || digit == 7 {
n = n / 10
} else {
// When digit is not prime
result = false
}
}
}
if result {
fmt.Print("\n ", num, " is full prime number ")
} else {
fmt.Print("\n ", num, " is not full prime number ")
}
}
func main() {

// Test A
// n = 2357
isFullPrime(2357)
// Test B
// n = 231
isFullPrime(231)
}``````

#### Output

`````` 2357 is full prime number
231 is not full prime number``````
``````<?php
/*
Php Program
Check if a number is full prime number
*/
{
public	function isPrime(\$n)
{
if (\$n <= 1)
{
return false;
}
//Base case
if (\$n == 2 || \$n == 3 || \$n == 5)
{
return true;
}
// Check divisibility of a number
for (\$i = (int)(\$n / 2); \$i > 1; --\$i)
{
if (\$n % \$i == 0)
{
return false;
}
}
return true;
}
public	function isFullPrime(\$num)
{
\$result = false;
if (\$this->isPrime(\$num))
{
\$result = true;
\$n = \$num;
\$digit = 0;
while (\$n > 0 && \$result)
{
// Get last digit
\$digit = \$n % 10;
if (\$digit == 2 || \$digit == 3 ||
\$digit == 5 || \$digit == 7)
{
\$n = (int)(\$n / 10);
}
else
{
// When digit is not prime
\$result = false;
}
}
}
if (\$result)
{
echo("\n ".\$num.
" is full prime number ");
}
else
{
echo("\n ".\$num.
" is not full prime number ");
}
}
}

function main()
{
// Test A
// n = 2357
// Test B
// n = 231
}
main();``````

#### Output

`````` 2357 is full prime number
231 is not full prime number``````
``````/*
Node JS Program
Check if a number is full prime number
*/
{
isPrime(n)
{
if (n <= 1)
{
return false;
}
//Base case
if (n == 2 || n == 3 || n == 5)
{
return true;
}
// Check divisibility of a number
for (var i = parseInt(n / 2); i > 1; --i)
{
if (n % i == 0)
{
return false;
}
}
return true;
}
isFullPrime(num)
{
var result = false;
if (this.isPrime(num))
{
result = true;
var n = num;
var digit = 0;
while (n > 0 && result)
{
// Get last digit
digit = n % 10;
if (digit == 2 || digit == 3 ||
digit == 5 || digit == 7)
{
n = parseInt(n / 10);
}
else
{
// When digit is not prime
result = false;
}
}
}
if (result)
{
process.stdout.write("\n " + num + " is full prime number ");
}
else
{
process.stdout.write("\n " + num + " is not full prime number ");
}
}
}

function main()
{
// Test A
// n = 2357
// Test B
// n = 231
}
main();``````

#### Output

`````` 2357 is full prime number
231 is not full prime number``````
``````#    Python 3 Program
#    Check if a number is full prime number
def isPrime(self, n) :
if (n <= 1) :
return False

# Base case
if (n == 2 or n == 3 or n == 5) :
return True

i = int(n / 2)
#  Check divisibility of a number
while (i > 1) :
if (n % i == 0) :
return False

i -= 1

return True

def isFullPrime(self, num) :
result = False
if (self.isPrime(num)) :
result = True
n = num
digit = 0
while (n > 0 and result) :
#  Get last digit
digit = n % 10
if (digit == 2 or digit == 3 or
digit == 5 or digit == 7) :
n = int(n / 10)
else :
#  When digit is not prime
result = False

if (result) :
print("\n ", num ," is full prime number ", end = "")
else :
print("\n ", num ," is not full prime number ", end = "")

def main() :
#  Test A
#  n = 2357
#  Test B
#  n = 231

if __name__ == "__main__": main()``````

#### Output

``````  2357  is full prime number
231  is not full prime number``````
``````#    Ruby Program
#    Check if a number is full prime number
def isPrime(n)
if (n <= 1)
return false
end

# Base case
if (n == 2 || n == 3 || n == 5)
return true
end

i = n / 2
#  Check divisibility of a number
while (i > 1)
if (n % i == 0)
return false
end

i -= 1
end

return true
end

def isFullPrime(num)
result = false
if (self.isPrime(num))
result = true
n = num
digit = 0
while (n > 0 && result)
#  Get last digit
digit = n % 10
if (digit == 2 || digit == 3 ||
digit == 5 || digit == 7)
n = n / 10
else

#  When digit is not prime
result = false
end

end

end

if (result)
print("\n ", num ," is full prime number ")
else

print("\n ", num ," is not full prime number ")
end

end

end

def main()
#  Test A
#  n = 2357
#  Test B
#  n = 231
end

main()``````

#### Output

`````` 2357 is full prime number
231 is not full prime number ``````
``````/*
Scala Program
Check if a number is full prime number
*/
{
def isPrime(n: Int): Boolean = {
if (n <= 1)
{
return false;
}
//Base case
if (n == 2 || n == 3 || n == 5)
{
return true;
}
var i: Int = n / 2;
// Check divisibility of a number
while (i > 1)
{
if (n % i == 0)
{
return false;
}
i -= 1;
}
return true;
}
def isFullPrime(num: Int): Unit = {
var result: Boolean = false;
if (isPrime(num))
{
result = true;
var n: Int = num;
var digit: Int = 0;
while (n > 0 && result)
{
// Get last digit
digit = n % 10;
if (digit == 2 || digit == 3 ||
digit == 5 || digit == 7)
{
n = n / 10;
}
else
{
// When digit is not prime
result = false;
}
}
}
if (result)
{
print("\n " + num + " is full prime number ");
}
else
{
print("\n " + num + " is not full prime number ");
}
}
}
object Main
{
def main(args: Array[String]): Unit = {
// Test A
// n = 2357
// Test B
// n = 231
}
}``````

#### Output

`````` 2357 is full prime number
231 is not full prime number``````
``````/*
Swift 4 Program
Check if a number is full prime number
*/
{
func isPrime(_ n: Int) -> Bool
{
if (n <= 1)
{
return false;
}
//Base case
if (n == 2 || n == 3 || n == 5)
{
return true;
}
var i: Int = n / 2;
// Check divisibility of a number
while (i > 1)
{
if (n % i == 0)
{
return false;
}
i -= 1;
}
return true;
}
func isFullPrime(_ num: Int)
{
var result: Bool = false;
if (self.isPrime(num))
{
result = true;
var n: Int = num;
var digit: Int = 0;
while (n > 0 && result)
{
// Get last digit
digit = n % 10;
if (digit == 2 || digit == 3 ||
digit == 5 || digit == 7)
{
n = n / 10;
}
else
{
// When digit is not prime
result = false;
}
}
}
if (result)
{
print("\n ", num ," is full prime number ", terminator: "");
}
else
{
print("\n ", num ," is not full prime number ", terminator: "");
}
}
}
func main()
{
// Test A
// n = 2357
// Test B
// n = 231
}
main();``````

#### Output

``````  2357  is full prime number
231  is not full prime number``````
``````/*
Kotlin Program
Check if a number is full prime number
*/
{
fun isPrime(n: Int): Boolean
{
if (n <= 1)
{
return false;
}
//Base case
if (n == 2 || n == 3 || n == 5)
{
return true;
}
var i: Int = n / 2;
// Check divisibility of a number
while (i > 1)
{
if (n % i == 0)
{
return false;
}
i -= 1;
}
return true;
}
fun isFullPrime(num: Int): Unit
{
var result: Boolean = false;
if (this.isPrime(num))
{
result = true;
var n: Int = num;
var digit: Int ;
while (n > 0 && result)
{
// Get last digit
digit = n % 10;
if (digit == 2 || digit == 3 ||
digit == 5 || digit == 7)
{
n = n / 10;
}
else
{
// When digit is not prime
result = false;
}
}
}
if (result)
{
print("\n " + num + " is full prime number ");
}
else
{
print("\n " + num + " is not full prime number ");
}
}
}
fun main(args: Array < String > ): Unit
{
// Test A
// n = 2357
// Test B
// n = 231
}``````

#### Output

`````` 2357 is full prime number
231 is not full prime number``````

## Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.