T = gets.to_i
def prime(input)
flag = 0
return puts "Not prime" if input == 1
for n in 2..(Math.sqrt(input))
if input%n == 0
flag = 1
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
public static void main(String[] args) { | |
String[][] spiral = new String[3][3]; | |
spiral[0][0] = "1"; | |
spiral[0][1] = "2"; | |
spiral[0][2] = "3"; | |
spiral[1][0] = "4"; | |
spiral[1][1] = "5"; | |
spiral[1][2] = "6"; | |
spiral[2][0] = "7"; |
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
using System; | |
using System.Collections.Generic; | |
namespace HappyAndSadNumbers | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string input; |
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
# method for finding happy or sad number | |
def happy_or_sad(input) | |
result = 0 | |
repeated_number = Hash.new(); | |
while(!repeated_number.has_key?(input)) | |
temp = 0 | |
repeated_number[input] = 0 | |
input.each do |i| | |
temp = temp + (i.to_i * i.to_i) |
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
using System; | |
using System.Collections.Generic; | |
namespace CombineSequenceNumbers | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string input; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Centering a form</title> | |
</head> | |
<body> | |
<div class="form"> | |
<label>Name</label> | |
<input type="text" name="name"> |
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
<% flash.each do |type, message| %> | |
<div class="alert <%= bootstrap_class_for(type) %> fade in"> | |
<button class="close" data-dismiss="alert">×</button> | |
<%= message %> | |
</div> | |
<% end %> |
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
using System; | |
using System.IO; | |
namespace FileMovement | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string sourcePath = @"G:\Learning\CSharp\FileMovement\FileMovement\"; |
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
using System; | |
using System.IO; | |
namespace FileMovement | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string sourcePath = @"G:\Learning\CSharp\FileMovement\FileMovement\"; |
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
// Code from Project 1 | |
namespace FirstAssembly | |
{ | |
public class FirstClass | |
{ | |
private protected static void FirstMethod() | |
{ | |
Console.WriteLine("Private protected method called..."); | |
} | |
} |
OlderNewer