Strings operation in perl
Coder's point
by
5y ago
my $s = "CODERSPOINT"; print(length($s),"\n"); print("To lower case: "); print(lc($s),"\n"); OUTPUT: 11 To lower case : coderspoint ..read more
Visit website
Triangle pattern
Coder's point
by
5y ago
for($i=1;$i<=5;$i=$i+1){ for($j=1;$j<=5-$i;$j=$j+1){ print" "; } while($k!=2*$i-1){ print"* "; $k=$k+1; } $k=0; print"\n"; } OUTPUT ..read more
Visit website
Find area using subroutine
Coder's point
by
5y ago
sub area { print "Enter the side "; $side=<> ; return ($side * $side); } $totalArea = area(); printf $totalArea; OUTPUT: Enter the side 4 16 ..read more
Visit website
Prime number in perl
Coder's point
by
5y ago
#!/usr/local/bin/perl print "Enter a number : "; $num = <>; for($i=2;$i<=$num-1;$i++) { if($num%$i==0) { $flag=1; break; } } if($flag==1) { print "Not a prime number"; } else { print "Prime number" } OUTPUT: Enter a number : 7 Prime number Enter a number : 16 Not a prime number ..read more
Visit website
Multiplication table
Coder's point
by
5y ago
print "Enter the number:"; $n = <> ; print"\nMultiplication Table Of $n>>"; for($i=1;$i<=10;$i=$i+1){ $m=$n*$i; print"\n$m"; } print"\n"; Multiplication Table Of 12 >> 12 24 36 48 60 72 84 96 108 120 ..read more
Visit website
Strings operation in perl
Coder's point
by
5y ago
my $s = "CODERSPOINT"; print(length($s),"\n"); print("To lower case: "); print(lc($s),"\n"); OUTPUT: 11 To lower case : coderspoint ..read more
Visit website
To demonstrate basic arithmetic operators
Coder's point
by
5y ago
#!/usr/local/bin/perl print "Enter first number : "; $a = <>; print "Enter second Number : "; $b = <>; $add=$a+$b; print ("Addition = $add\n"); $sub=$a-$b; print ("subtraction = $sub\n"); $mul=$a*$b; print ("Multiplication = $mul\n"); $div=$a/$b; print ("division = $div\n"); OUTPUT: Enter first number : 15 Enter second number : 5 Addition=20 Subtraction=10 Multiplicstion=75 Division=3 ..read more
Visit website
Even/Odd program in perl
Coder's point
by
5y ago
#!/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 ..read more
Visit website
Calculator
Coder's point
by
5y ago
public class Calculator { static void main() { java.util.Scanner in = new java.util.Scanner(System.in); System.out.println("Enter 2 nos."); double a=in.nextInt(); double b=in.nextInt(); System.out.println("Enter operator + or - or * or /"); char ch=in.next().charAt(0); System.out.println("Result:"); switch(ch) { case '+': System.out.println(a+b); break; case '-': System.out.println(a-b); break; case '*': System.out.println(a*b); break; case '/': if(b==0)System.out.printl ..read more
Visit website
Leap Year
Coder's point
by
5y ago
import java.util.Scanner; public class LeapYear { boolean isLeapYear(int y) { if(y%100==0) { if(y%400==0) { return true; } } else if(y%4==0) { return true; } return false; } static void main() { Scanner in = new Scanner(System.in); System.out.println("Enter a year"); int y=in.nextInt(); if(new LeapYear().isLeapYear(y)) { System.out.println("Leap Year"); } else { System.out.println("Not a Leap ..read more
Visit website

Follow Coder's point on FeedSpot

Continue with Google
Continue with Apple
OR