aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-06-23 09:44:31 +0100
committerGitHub <noreply@github.com>2021-06-23 09:44:31 +0100
commit9f441f58dd667a6762f94005037372d061112690 (patch)
treeca1e37595c698ff46a7a329fb3a960258bbe1333
parent79d64ef6608489725ff3a4d57d436f3e0d76dd9d (diff)
parent35adf4aa60eef8436f21ab4d5fd91b241d1be9f6 (diff)
downloadperlweeklychallenge-club-9f441f58dd667a6762f94005037372d061112690.tar.gz
perlweeklychallenge-club-9f441f58dd667a6762f94005037372d061112690.tar.bz2
perlweeklychallenge-club-9f441f58dd667a6762f94005037372d061112690.zip
Merge pull request #4328 from vinodk89/branch-for-challenge-117
Solutions for challenge 118 - Task#1
-rw-r--r--challenge-118/vinod-k/perl/ch-1.pl11
1 files changed, 11 insertions, 0 deletions
diff --git a/challenge-118/vinod-k/perl/ch-1.pl b/challenge-118/vinod-k/perl/ch-1.pl
new file mode 100644
index 0000000000..efb25316af
--- /dev/null
+++ b/challenge-118/vinod-k/perl/ch-1.pl
@@ -0,0 +1,11 @@
+use strict; use warnings;
+
+my $N = $ARGV[0] || die "Please enter an integer";
+
+my $N_Bin = sprintf ("%b", $N);
+
+if( $N_Bin eq reverse($N_Bin)){
+ print "1 as binary representation of $N is $N_Bin which is Palindrome\n";
+} else {
+ print "0 as binary representation of $N is $N_Bin which is NOT Palindrome\n";
+}