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
#output grade results dependent on student score | |
puts "Enter the students score: " | |
score = gets.to_i | |
while score > 100 | |
puts "You must enter a number less then or equal to 100 " | |
puts "Enter the students score: " | |
score = gets.to_i | |
end | |
while score == 100 |
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
<?php | |
require_once('TwitterAPIExchange.php'); | |
$settings = array( | |
'oauth_access_token' => "", | |
'oauth_access_token_secret' => "", | |
'consumer_key' => "", | |
'consumer_secret' => "" | |
); | |
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
<script src="http://code.jquery.com/jquery-2.1.3.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$("#submit").click(function(){ | |
var postInputVal = $("#postinput").val(); | |
$("#postecho").val(postInputVal); | |
console.log("OK!"); | |
}); | |
}); | |
</script> |
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.util.Scanner; | |
class primeNumber { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
System.out.print("Enter your input number:"); | |
int n = scanner.nextInt(); | |
int j = 2; | |
int result = 0; | |
while (j <= n / 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
import java.util.Scanner; // initialize scanner | |
// Pythagorean Theorem a^2 + b^2 = c^2 | |
public class PythagoreanTriple | |
{ | |
public static void main( String[] args ) | |
{ | |
for ( int a = 1; a <= 500; a++ ) | |
{ | |
for ( int b = 1; b <= 500; b++ ) | |
{ |
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
<?php | |
echo "Enter the experience:"; | |
$exp = trim(fgets(STDIN)); | |
echo "Enter the age of the person:"; | |
$age = trim(fgets(STDIN)); | |
while ($exp == 0){ | |
$salary = 2000; | |
echo $salary; | |
exit; |
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
<?php | |
echo "Enter 1st number:"; | |
$num1 = trim(fgets(STDIN)); | |
echo "Enter 2nd number:"; | |
$num2 = trim(fgets(STDIN)); | |
$sum = $num1 + $num2; //sum | |
echo ("Sum: "."\n".$sum."\n \n"); | |
$dif = $num1 - $num2; //difference | |
echo ("Difference: "."\n".$dif."\n \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
<?php | |
// using method array_reverse | |
echo "Enter 5 elements:"; | |
for($i = 0 ; $i<5;$i++) | |
{ | |
$arr[$i]=trim(fgets(STDIN)); | |
} | |
echo "\nYour input: \n"; | |
foreach ($arr as $value1){ |
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
<?php | |
//Program that finds the most frequent element in an array. | |
$data=Array(); | |
echo "Enter numbers:"; | |
for($i=0;$i<6;$i++) | |
{ | |
$data[$i]=trim(fgets(STDIN));; | |
} | |
// Using methods: array_count_values, arsort, array_keys |
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
<?php | |
// Queries twitter using specific keyword and posts most recent 100 tweets | |
error_reporting(E_ERROR); | |
$json = file_get_contents("http://mikestratton.net/temp/bigdatabox/src/raw_twitter_Lebron_James.php"); | |
$t_query = json_decode($json,true); | |
$query = $t_query ['search_metadata']['query']; | |
echo "<h1>Users Tweeting About: ".$query." </h1>"; | |
reset($t_query); |