Skip to content

Instantly share code, notes, and snippets.

@dzsquared
dzsquared / fib sequence.cs
Created December 30, 2016 02:44
fib sequence created by dzsquared - https://repl.it/Exxp/0
using System;
using System.Collections.Generic;
using System.IO;
class Solution {
static void Main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */
string[] theInput = Console.ReadLine().Split(' ');
int howFar = Convert.ToInt32(theInput[2]);
ulong[] theResults = new UInt64[howFar+2];
theResults[0] = Convert.ToUInt64(theInput[0]);
@dzsquared
dzsquared / intro to sorting.cs
Created December 30, 2016 02:44
intro to sorting created by dzsquared - https://repl.it/Ex6a/0
using System;
using System.Collections.Generic;
using System.IO;
class Solution {
static void Main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */
int findMe = Convert.ToInt32(Console.ReadLine());
int arraySize = Convert.ToInt32(Console.ReadLine());
int foundHere = 0;
string[] findHere = Console.ReadLine().Split(' ');
@dzsquared
dzsquared / arrays and loops.cs
Created December 30, 2016 02:44
arrays and loops created by dzsquared - https://repl.it/Ewyw/0
using System;
using System.Collections.Generic;
using System.IO;
class Solution {
static void Main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */
int lineCount;
lineCount = Convert.ToInt32(Console.ReadLine());
for(int i = 1; i <= lineCount; i++) {
string theword = Console.ReadLine();
@dzsquared
dzsquared / class example.cs
Created December 30, 2016 02:45
class example created by dzsquared - https://repl.it/Ewys/0
class Person {
public int age;
public Person(int initialAge) {
// Add some more code to run some checks on initialAge
if (initialAge < 0) {
Console.WriteLine("Age is not valid, setting age to 0.");
this.age = 0;
} else {
this.age = initialAge;
}
@dzsquared
dzsquared / conditions.cs
Created December 30, 2016 02:45
conditions created by dzsquared - https://repl.it/Ewyo/0
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {
static void Main(String[] args) {
int N = Convert.ToInt32(Console.ReadLine());
if (N%2 == 0) {
if(N >= 2 && N<= 5) {
@dzsquared
dzsquared / operators.cs
Created December 30, 2016 02:45
operators created by dzsquared - https://repl.it/Ewyl/0
using System;
using System.Collections.Generic;
using System.IO;
class MealCalculator {
static void Main(String[] args) {
double mealCost;
int tipPercent;
int taxPercent;
using System;
using System.Collections.Generic;
using System.IO;
class Solution {
static int factorial(int thenumber) {
if(thenumber <= 1) {
return 1;
} else {
return thenumber * factorial(thenumber-1);
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {
static void Main(String[] args) {
int n = Convert.ToInt32(Console.ReadLine());
string thebinary = Convert.ToString(n, 2);
char[] binaryArray = thebinary.ToCharArray();
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {
static void Main(String[] args) {
int[][] arr = new int[6][];
for(int arr_i = 0; arr_i < 6; arr_i++){
string[] arr_temp = Console.ReadLine().Split(' ');
class Student : Person{
private int[] testScores;
public Student(string firstName, string lastName, int identification, int[] scores) {
this.firstName = firstName;
this.lastName = lastName;
this.id = identification;
this.testScores = scores;
}
public string calculate() {