This file contains 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
function Fib(){ | |
this.num1 = 1; | |
this.num2 = 2; | |
this.sequence = [this.num1, this.num2]; | |
this.sum = 2; | |
} | |
Fib.prototype.fibSequence = function (){ | |
var num1 = this.num1; | |
var num2 = this.num2; |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
double convert_to_faren(double celcius); | |
double convert_to_celsius(double faren); | |
double convert_to_faren(double celcius){ |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
// given a number find its factorial | |
int get_factorial(int num); | |
int get_factorial(int num){ | |
int i, j; | |
This file contains 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
#include <stdio.h> | |
int sum_of_multiples(int range); | |
int sum_of_multiples(int range){ | |
int i, sum; | |
sum = 0; | |
for(i=0;i<range;i++){ | |
if( i%3 == 0 || i%5 == 0 ) { |
This file contains 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
#include <stdio.h> | |
int fib_sum_of_even_numbers(int n); | |
int fib_sum_of_even_numbers(int n){ | |
int num1 = 1, num2 = 2, temp_num = 0; | |
int sum = num2; | |
while(num2 < n){ |
This file contains 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
#include <stdio.h> | |
#include <math.h> | |
int main(void) | |
{ | |
long long num = 600851475143; | |
long long limit = (long long) sqrt(num); | |
long long i; | |
// find a number that is divisible by the num (has a modulus 0) |
This file contains 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
#include <stdio.h> | |
// loop up three digit numbers | |
// get the product and check | |
// if it is a palindrome | |
// first test with two-digit | |
void *itoarr(int n, int arr[]); | |
int is_palindrome(int n); |
This file contains 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
#include <stdio.h> | |
int main(void){ | |
unsigned int i = 20; | |
unsigned int j = i; | |
while(i>0){ | |
if(j%i != 0){ |
This file contains 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
#include <stdio.h> | |
#include <math.h> | |
int main(void){ | |
double i = 1; | |
double x, y; | |
int diff; | |
while(i<=100){ |
This file contains 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
#include <stdio.h> | |
int main(void){ | |
int i, j, last_not_prime, last_prime; | |
int count = 0; | |
i = 2; | |
while(count < 10001){ |
OlderNewer