# Check if a number is jumbled or not

Here given code implementation process.

``````// C Program
// Check if a number is jumbled or not
#include <stdio.h>

// Determine whether given number is jumbled number or not
void is_jumbled_no(int data)
{
//Used to determine jumbled number
int status = 0;
int num = data;
if (data < 0)
{
//if number is negative then transform into a positive number
num = -num;
}
if (num >= 0 && num <= 9)
{
//When given number is a single digit number
status = 1;
}
else
{
//Get last digit of given number
int l_digit = num % 10;
//This is used to store last digit of current number
int c_digit = 0;
//Remove last digit
num = num / 10;
//Set the everything is good
status = 1;
while (status == 1 && num != 0)
{
//Get last digit of current number
c_digit = num % 10;
if (c_digit == l_digit || c_digit + 1 == l_digit || c_digit - 1 == l_digit)
{
//When digit difference are under a jumbled number
//Get new last digit
l_digit = c_digit;
//Remove last digit
num = num / 10;
}
else
{
//When not jumbled number
status = 0;
}
}
}
if (status == 0)
{
//When number are not jumbled
printf("\n Number %d are not jumbled number \n", data);
}
else
{
//When number is jumbled number
printf("\n Number %d is jumbled number \n", data);
}
}
int main()
{
// Test case
is_jumbled_no(123);
is_jumbled_no(4234);
is_jumbled_no(-1234);
is_jumbled_no(-444);
is_jumbled_no(14441);
return 0;
}``````

#### Output

`````` Number 123 is jumbled number

Number 4234 are not jumbled number

Number -1234 is jumbled number

Number -444 is jumbled number

Number 14441 are not jumbled number``````
``````// Java Program
// Check if a number is jumbled or not
public class JumbledNumber
{
// Determine whether given number is jumbled number or not
public void is_jumbled_no(int data)
{
//Used to determine jumbled number
int status = 0;
//Store the given number
int num = data;
if (data < 0)
{
//if number is negative then transform into a positive number
num = -num;
}
if (num >= 0 && num <= 9)
{
//When given number is a single digit number
status = 1;
}
else
{
//Get last digit of given number
int l_digit = num % 10;
//This is used to store last digit of current number
int c_digit = 0;
//Remove last digit
num = num / 10;
//Set the everything is good
status = 1;
while (status == 1 && num != 0)
{
//Get last digit of current number
c_digit = num % 10;
if (c_digit == l_digit || c_digit + 1 == l_digit || c_digit - 1 == l_digit)
{
//When digit difference are under a jumbled number
//Get new last digit
l_digit = c_digit;
//Remove last digit
num = num / 10;
}
else
{
//When not jumbled number
status = 0;
}
}
}
if (status == 0)
{
//When number are not jumbled
System.out.print("\n Number " + data + " are not jumbled number \n");
}
else
{
//When number is jumbled number
System.out.print("\n Number " + data + " is jumbled number \n");
}
}
public static void main(String[] args)
{
JumbledNumber obj = new JumbledNumber();
// Test case
obj.is_jumbled_no(123);
obj.is_jumbled_no(4234);
obj.is_jumbled_no(-1234);
obj.is_jumbled_no(-444);
obj.is_jumbled_no(14441);
}
}``````

#### Output

`````` Number 123 is jumbled number

Number 4234 are not jumbled number

Number -1234 is jumbled number

Number -444 is jumbled number

Number 14441 are not jumbled number``````
``````//Include header file
#include <iostream>

using namespace std;
// C++ Program
// Check if a number is jumbled or not
class JumbledNumber
{
public:
// Determine whether given number is jumbled number or not
void is_jumbled_no(int data)
{
//Used to determine jumbled number
int status = 0;
//Store the given number
int num = data;
if (data < 0)
{
//if number is negative then transform into a positive number
num = -num;
}
if (num >= 0 && num <= 9)
{
//When given number is a single digit number
status = 1;
}
else
{
//Get last digit of given number
int l_digit = num % 10;
//This is used to store last digit of current number
int c_digit = 0;
//Remove last digit
num = num / 10;
//Set the everything is good
status = 1;
while (status == 1 && num != 0)
{
//Get last digit of current number
c_digit = num % 10;
if (c_digit == l_digit || c_digit + 1 == l_digit || c_digit - 1 == l_digit)
{
//When digit difference are under a jumbled number
//Get new last digit
l_digit = c_digit;
//Remove last digit
num = num / 10;
}
else
{
//When not jumbled number
status = 0;
}
}
}
if (status == 0)
{
//When number are not jumbled
cout << "\n Number " << data << " are not jumbled number \n";
}
else
{
//When number is jumbled number
cout << "\n Number " << data << " is jumbled number \n";
}
}
};
int main()
{
JumbledNumber obj = JumbledNumber();
// Test case
obj.is_jumbled_no(123);
obj.is_jumbled_no(4234);
obj.is_jumbled_no(-1234);
obj.is_jumbled_no(-444);
obj.is_jumbled_no(14441);
return 0;
}``````

#### Output

`````` Number 123 is jumbled number

Number 4234 are not jumbled number

Number -1234 is jumbled number

Number -444 is jumbled number

Number 14441 are not jumbled number``````
``````//Include namespace system
using System;

// C# Program
// Check if a number is jumbled or not

public class JumbledNumber
{
// Determine whether given number is jumbled number or not
public void is_jumbled_no(int data)
{
//Used to determine jumbled number
int status = 0;
//Store the given number
int num = data;
if (data < 0)
{
//if number is negative then transform into a positive number
num = -num;
}
if (num >= 0 && num <= 9)
{
//When given number is a single digit number
status = 1;
}
else
{
//Get last digit of given number
int l_digit = num % 10;
//This is used to store last digit of current number
int c_digit = 0;
//Remove last digit
num = num / 10;
//Set the everything is good
status = 1;
while (status == 1 && num != 0)
{
//Get last digit of current number
c_digit = num % 10;
if (c_digit == l_digit || c_digit + 1 == l_digit || c_digit - 1 == l_digit)
{
//When digit difference are under a jumbled number
//Get new last digit
l_digit = c_digit;
//Remove last digit
num = num / 10;
}
else
{
//When not jumbled number
status = 0;
}
}
}
if (status == 0)
{
//When number are not jumbled
Console.Write("\n Number " + data + " are not jumbled number \n");
}
else
{
//When number is jumbled number
Console.Write("\n Number " + data + " is jumbled number \n");
}
}
public static void Main(String[] args)
{
JumbledNumber obj = new JumbledNumber();
// Test case
obj.is_jumbled_no(123);
obj.is_jumbled_no(4234);
obj.is_jumbled_no(-1234);
obj.is_jumbled_no(-444);
obj.is_jumbled_no(14441);
}
}``````

#### Output

`````` Number 123 is jumbled number

Number 4234 are not jumbled number

Number -1234 is jumbled number

Number -444 is jumbled number

Number 14441 are not jumbled number``````
``````<?php
// Php Program
// Check if a number is jumbled or not

class JumbledNumber
{
// Determine whether given number is jumbled number or not
public	function is_jumbled_no(\$data)
{
//Used to determine jumbled number
\$status = 0;
//Store the given number
\$num = \$data;
if (\$data < 0)
{
//if number is negative then transform into a positive number
\$num = -\$num;
}
if (\$num >= 0 && \$num <= 9)
{
//When given number is a single digit number
\$status = 1;
}
else
{
//Get last digit of given number
\$l_digit = \$num % 10;
//This is used to store last digit of current number
\$c_digit = 0;
//Remove last digit
\$num = intval(\$num / 10);
//Set the everything is good
\$status = 1;
while (\$status == 1 && \$num != 0)
{
//Get last digit of current number
\$c_digit = \$num % 10;
if (\$c_digit == \$l_digit || \$c_digit + 1 == \$l_digit || \$c_digit - 1 == \$l_digit)
{
//When digit difference are under a jumbled number
//Get new last digit
\$l_digit = \$c_digit;
//Remove last digit
\$num = intval(\$num / 10);
}
else
{
//When not jumbled number
\$status = 0;
}
}
}
if (\$status == 0)
{
//When number are not jumbled
echo "\n Number ". \$data ." are not jumbled number \n";
}
else
{
//When number is jumbled number
echo "\n Number ". \$data ." is jumbled number \n";
}
}
}

function main()
{
\$obj = new JumbledNumber();
// Test case
\$obj->is_jumbled_no(123);
\$obj->is_jumbled_no(4234);
\$obj->is_jumbled_no(-1234);
\$obj->is_jumbled_no(-444);
\$obj->is_jumbled_no(14441);
}
main();``````

#### Output

`````` Number 123 is jumbled number

Number 4234 are not jumbled number

Number -1234 is jumbled number

Number -444 is jumbled number

Number 14441 are not jumbled number``````
``````// Node Js Program
// Check if a number is jumbled or not
class JumbledNumber
{
// Determine whether given number is jumbled number or not
is_jumbled_no(data)
{
//Used to determine jumbled number
var status = 0;
//Store the given number
var num = data;
if (data < 0)
{
//if number is negative then transform into a positive number
num = -num;
}
if (num >= 0 && num <= 9)
{
//When given number is a single digit number
status = 1;
}
else
{
//Get last digit of given number
var l_digit = num % 10;
//This is used to store last digit of current number
var c_digit = 0;
//Remove last digit
num = parseInt(num / 10);
//Set the everything is good
status = 1;
while (status == 1 && num != 0)
{
//Get last digit of current number
c_digit = num % 10;
if (c_digit == l_digit || c_digit + 1 == l_digit || c_digit - 1 == l_digit)
{
//When digit difference are under a jumbled number
//Get new last digit
l_digit = c_digit;
//Remove last digit
num = parseInt(num / 10);
}
else
{
//When not jumbled number
status = 0;
}
}
}
if (status == 0)
{
//When number are not jumbled
process.stdout.write("\n Number " + data + " are not jumbled number \n");
}
else
{
//When number is jumbled number
process.stdout.write("\n Number " + data + " is jumbled number \n");
}
}
}

function main()
{
var obj = new JumbledNumber();
// Test case
obj.is_jumbled_no(123);
obj.is_jumbled_no(4234);
obj.is_jumbled_no(-1234);
obj.is_jumbled_no(-444);
obj.is_jumbled_no(14441);
}
main();``````

#### Output

`````` Number 123 is jumbled number

Number 4234 are not jumbled number

Number -1234 is jumbled number

Number -444 is jumbled number

Number 14441 are not jumbled number``````
``````#  Python 3 Program
#  Check if a number is jumbled or not
class JumbledNumber :
#  Determine whether given number is jumbled number or not
def is_jumbled_no(self, data) :
# Used to determine jumbled number
status = 0
# Store the given number
num = data
if (data < 0) :
# if number is negative then transform into a positive number
num = -num

if (num >= 0 and num <= 9) :
# When given number is a single digit number
status = 1
else :
# Get last digit of given number
l_digit = num % 10
# This is used to store last digit of current number
c_digit = 0
# Remove last digit
num = int(num / 10)
# Set the everything is good
status = 1
while (status == 1 and num != 0) :
# Get last digit of current number
c_digit = num % 10
if (c_digit == l_digit or c_digit + 1 == l_digit or c_digit - 1 == l_digit) :
# When digit difference are under a jumbled number
# Get new last digit
l_digit = c_digit
# Remove last digit
num = int(num / 10)
else :
# When not jumbled number
status = 0

if (status == 0) :
# When number are not jumbled
print("\n Number ", data ," are not jumbled number \n", end = "")
else :
# When number is jumbled number
print("\n Number ", data ," is jumbled number \n", end = "")

def main() :
obj = JumbledNumber()
#  Test case
obj.is_jumbled_no(123)
obj.is_jumbled_no(4234)
obj.is_jumbled_no(-1234)
obj.is_jumbled_no(-444)
obj.is_jumbled_no(14441)

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

#### Output

`````` Number  123  is jumbled number

Number  4234  are not jumbled number

Number  -1234  is jumbled number

Number  -444  is jumbled number

Number  14441  are not jumbled number``````
``````#  Ruby Program
#  Check if a number is jumbled or not
class JumbledNumber

#  Determine whether given number is jumbled number or not
def is_jumbled_no(data)

# Used to determine jumbled number
status = 0
# Store the given number
num = data
if (data < 0)

# if number is negative then transform into a positive number
num = -num
end
if (num >= 0 && num <= 9)

# When given number is a single digit number
status = 1
else

# Get last digit of given number
l_digit = num % 10
# This is used to store last digit of current number
c_digit = 0
# Remove last digit
num = num / 10
# Set the everything is good
status = 1
while (status == 1 && num != 0)

# Get last digit of current number
c_digit = num % 10
if (c_digit == l_digit || c_digit + 1 == l_digit || c_digit - 1 == l_digit)

# When digit difference are under a jumbled number
# Get new last digit
l_digit = c_digit
# Remove last digit
num = num / 10
else

# When not jumbled number
status = 0
end
end
end
if (status == 0)

# When number are not jumbled
print("\n Number ", data ," are not jumbled number \n")
else

# When number is jumbled number
print("\n Number ", data ," is jumbled number \n")
end
end
end
def main()

obj = JumbledNumber.new()
#  Test case
obj.is_jumbled_no(123)
obj.is_jumbled_no(4234)
obj.is_jumbled_no(-1234)
obj.is_jumbled_no(-444)
obj.is_jumbled_no(14441)
end
main()``````

#### Output

`````` Number 123 is jumbled number

Number 4234 are not jumbled number

Number -1234 is jumbled number

Number -444 is jumbled number

Number 14441 are not jumbled number
``````
``````// Scala Program
// Check if a number is jumbled or not
class JumbledNumber
{
// Determine whether given number is jumbled number or not
def is_jumbled_no(data: Int): Unit = {
//Used to determine jumbled number
var status: Int = 0;
//Store the given number
var num: Int = data;
if (data < 0)
{
//if number is negative then transform into a positive number
num = -num;
}
if (num >= 0 && num <= 9)
{
//When given number is a single digit number
status = 1;
}
else
{
//Get last digit of given number
var l_digit: Int = num % 10;
//This is used to store last digit of current number
var c_digit: Int = 0;
//Remove last digit
num = (num / 10).toInt;
//Set the everything is good
status = 1;
while (status == 1 && num != 0)
{
//Get last digit of current number
c_digit = num % 10;
if (c_digit == l_digit || c_digit + 1 == l_digit || c_digit - 1 == l_digit)
{
//When digit difference are under a jumbled number
//Get new last digit
l_digit = c_digit;
//Remove last digit
num = (num / 10).toInt;
}
else
{
//When not jumbled number
status = 0;
}
}
}
if (status == 0)
{
//When number are not jumbled
print("\n Number " + data + " are not jumbled number \n");
}
else
{
//When number is jumbled number
print("\n Number " + data + " is jumbled number \n");
}
}
}
object Main
{
def main(args: Array[String]): Unit = {
var obj: JumbledNumber = new JumbledNumber();
// Test case
obj.is_jumbled_no(123);
obj.is_jumbled_no(4234);
obj.is_jumbled_no(-1234);
obj.is_jumbled_no(-444);
obj.is_jumbled_no(14441);
}
}``````

#### Output

`````` Number 123 is jumbled number

Number 4234 are not jumbled number

Number -1234 is jumbled number

Number -444 is jumbled number

Number 14441 are not jumbled number``````
``````// Swift Program
// Check if a number is jumbled or not
class JumbledNumber
{
// Determine whether given number is jumbled number or not
func is_jumbled_no(_ data: Int)
{
//Used to determine jumbled number
var status: Int = 0;
//Store the given number
var num: Int = data;
if (data < 0)
{
//if number is negative then transform into a positive number
num = -num;
}
if (num >= 0 && num <= 9)
{
//When given number is a single digit number
status = 1;
}
else
{
//Get last digit of given number
var l_digit: Int = num % 10;
//This is used to store last digit of current number
var c_digit: Int = 0;
//Remove last digit
num = num / 10;
//Set the everything is good
status = 1;
while (status == 1 && num != 0)
{
//Get last digit of current number
c_digit = num % 10;
if (c_digit == l_digit || c_digit + 1 == l_digit || c_digit - 1 == l_digit)
{
//When digit difference are under a jumbled number
//Get new last digit
l_digit = c_digit;
//Remove last digit
num = num / 10;
}
else
{
//When not jumbled number
status = 0;
}
}
}
if (status == 0)
{
//When number are not jumbled
print("\n Number ", data ," are not jumbled number \n", terminator: "");
}
else
{
//When number is jumbled number
print("\n Number ", data ," is jumbled number \n", terminator: "");
}
}
}
func main()
{
let obj: JumbledNumber = JumbledNumber();
// Test case
obj.is_jumbled_no(123);
obj.is_jumbled_no(4234);
obj.is_jumbled_no(-1234);
obj.is_jumbled_no(-444);
obj.is_jumbled_no(14441);
}
main();``````

#### Output

`````` Number  123  is jumbled number

Number  4234  are not jumbled number

Number  -1234  is jumbled number

Number  -444  is jumbled number

Number  14441  are not jumbled 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.