Skip to content

Instantly share code, notes, and snippets.

View Synxed's full-sized avatar

Synxed Synxed

  • Somewhere in milky way
View GitHub Profile
$count = 0;
while ( $count < 5 ) {
print "\nEnter a number: ";
$input = <STDIN>;
chomp($input);
@num[$count] = $input;
$count++;
}
$count=0 ;
while ($count < 5)
{
print "\nEnter a number: " ;
$input=<STDIN> ;
chomp($input) ;
@num[$count]=$input ;
$count++ ;
}
$string = "ABCDefg B.Tech";
$count = 0;
while ($string =~ m/B.Tech/) {
print "YES\n";
exit;
}
print "NO\n";
$string = "ABCDefg";
$count = 0;
while ($string =~ m/[AEIOUaeiou]/g) {
$count=$count+1;
}
print "There are ".$count." vowels in the string\n";
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;
}
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 = (
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 ;
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 {
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);
import java.awt.*;
import java.applet.*;
public class Banner extends Applet implements Runnable {
String msg = " It is a moving Banner. ";
char cha;
boolean stopFlag = true;
Thread t = null;
public void start() {