Skip to content

Instantly share code, notes, and snippets.

Avatar

Jane Ullah janoulle

View GitHub Profile
View ReversingString.java
/**
* Author: Jane Ullah
* Purpose: Reversing a string provided by the user.
* Date: 12/18/2011
*/
import java.util.Scanner;
public class ReversingString {
public static void main(String[] args) {
@janoulle
janoulle / Problem2.java
Created Dec 19, 2011
Problem 2 - Project Euler in Java by Jane Ullah
View Problem2.java
//Author: Jane Ullah
//Date: 12/19/2011
//Site: janetalkscode.com
long a1 = 0L, a2 = 1L;
long nextTerm = 0L;
long sumEvenTerms = 0L;
boolean fourMillionthReached = false;
while ( !fourMillionthReached ) {
if (nextTerm >= 4000000) {
@janoulle
janoulle / problem1.py
Created Dec 19, 2011
Problem 1 - Project Euler in Python by Jane Ullah
View problem1.py
x = 0
for i in range(0,1000):
if (i%3 == 0) or (i%5 == 0):
x += i;
print('total sum is: ' + str(x));
@janoulle
janoulle / Problem3.java
Created Dec 20, 2011
Problem 3 - Project Euler in Java by Jane Ullah
View Problem3.java
/**
*
* @author Jane Ullah
* @purpose Problem 3 - Project Euler
* @date 12/19/2011
*
*/
public static void main(String[] args) {
@janoulle
janoulle / Problem4.java
Created Dec 20, 2011
Problem 4 - Project Euler in Java by Jane Ullah
View Problem4.java
/**
*
* @author Jane Ullah
* @date 12/19/2011
* @purpose Solving Problem 4 from ProjectEuler.net
*
*/
public static void main(String[] args) {
/*if (isPalindrome(1222321)) {
System.out.println("Yes.");
@janoulle
janoulle / Problem5.java
Created Dec 27, 2011
Problem 5 - Project Euler in Java by Jane Ullah
View Problem5.java
/**
* @author Jane Ullah
* @purpose Problem 5 - Project Euler
* @date 12/26/2011
* @site http://janetalkscode.com
*/
public class Problem5 {
public static void main(String[] args) {
int sum = 1, primeNum = 0;
@janoulle
janoulle / Problem6.java
Created Dec 27, 2011
Problem 6 - Project Euler in Java by Jane Ullah
View Problem6.java
/**
* @author Jane Ullah
* @purpose Problem 6 - Project Euler
* @date 12/26/2011
* @site http://janetalkscode.com
*/
public class Problem6 {
public static void main(String[] args) {
@janoulle
janoulle / Problem7.java
Created Dec 27, 2011
Problem 7 - Project Euler in Java by Jane Ullah
View Problem7.java
/**
* @author Jane Ullah
* @purpose Problem 7 - Project Euler
* @date 12/27/2011
* @site http://janetalkscode.com
*/
public class Problem7 {
public static void main(String[] args) {
int primeNum = 0, index = 0;
@janoulle
janoulle / Problem8.java
Created Dec 28, 2011
Problem 8 - Project Euler in Java by Jane Ullah
View Problem8.java
/**
* @author Jane Ullah
* @purpose Problem 8 - Project Euler
* @date 12/28/2011
* @site http://janetalkscode.com
*/
public class Problem8 {
public static void main(String[] args) {
String digits = "73167176531330624919225119674426574742355349194934"
@janoulle
janoulle / parseString.java
Created Dec 29, 2011
Multiplying Digits in a String
View parseString.java
public static int parseString(String digits) {
int product = 1;
//Strips out non-word characters
digits = digits.replaceAll("\\W","");
for (int i = 0; i < digits.length(); i++){
product *= Integer.parseInt(digits.substring(i,(i+1)));
}
return (digits.length() > 0) ? product:0;
/*
You can’t perform that action at this time.