This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $count = 0; | |
| while ( $count < 5 ) { | |
| print "\nEnter a number: "; | |
| $input = <STDIN>; | |
| chomp($input); | |
| @num[$count] = $input; | |
| $count++; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $count=0 ; | |
| while ($count < 5) | |
| { | |
| print "\nEnter a number: " ; | |
| $input=<STDIN> ; | |
| chomp($input) ; | |
| @num[$count]=$input ; | |
| $count++ ; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $string = "ABCDefg B.Tech"; | |
| $count = 0; | |
| while ($string =~ m/B.Tech/) { | |
| print "YES\n"; | |
| exit; | |
| } | |
| print "NO\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $string = "ABCDefg"; | |
| $count = 0; | |
| while ($string =~ m/[AEIOUaeiou]/g) { | |
| $count=$count+1; | |
| } | |
| print "There are ".$count." vowels in the string\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use strict; | |
| use warnings; | |
| my $file = 'SnPmaster.txt'; | |
| open my $info, $file or die "Could not open $file: $!"; | |
| while( my $line = <$info>) { | |
| print $line; | |
| last if $. == 2; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use strict; | |
| use warnings; | |
| sub main | |
| { | |
| # Declare and initialize a hash. | |
| # In this example, both the keys | |
| # and values are strings. But | |
| # either or both could be numbers. | |
| my %hobbies = ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print "Enter a series of 5 numbers and I will sort them numerically for you\n\n" ; | |
| $count=0 ; | |
| while ($count < 5) | |
| { | |
| print "Please enter a number:" ; | |
| $input=<STDIN> ; | |
| chomp($input) ; | |
| @num[$count]=$input ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use strict; | |
| #example array | |
| my @arr = (4,7,2,77,8,4,9,3,35,7,678,1,9); | |
| #test | |
| print join(",",@arr); | |
| @arr = bubblesort(@arr); | |
| print "\n"; | |
| print join(",",@arr); | |
| #sort sub | |
| sub bubblesort { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.applet.*; | |
| import java.awt.*; | |
| public class Shape extends Applet { | |
| int x = 300, y = 100, r = 50; | |
| public void paint(Graphics g) { | |
| g.drawLine(30,300,200,10); | |
| g.drawOval(x-r,y-r,100,100); | |
| g.drawRect(400,50,200,50); | |
| g.drawPolygon(new int[] {10, 20, 30}, new int[] {100, 20, 100}, 3); |
NewerOlder