Even/Odd program in perl - Coder's point

Sunday, June 9, 2019

Even/Odd program in perl

 
#!/usr/local/bin/perl print "Enter a number"; $num = <>; $d=$num%2; if($d==0) { print "Even number"; } else { print "odd number"; }

 OUTPUT:  
 Enter a number 55  
 odd number  
 Enter a number 42  
 even number  

No comments:

Post a Comment