Skip to content

Instantly share code, notes, and snippets.

@toph113
toph113 / NumberGame.java
Created August 22, 2018 04:43
Number Guessing Game
import java.util.Scanner;
import java.util.Random;
public class NumberGame {
public static void main(String[] args) {
//Random Number Generation
Random rand = new Random();
//Scanning input from user
@toph113
toph113 / binPrint()
Last active August 29, 2015 13:57
Binary Printer Function
#include <stdio.h>
#include <conio.h>
int x;
char myArray[7];
void binPrint();
main(){
int y;
@toph113
toph113 / Binary Print
Created April 1, 2014 23:10
Binary Printer
#include <stdio.h>
#include <conio.h>
main(){
int x,y, mask = 0x80;
char myArray[7];
for(y=0;y<=3;y++){
printf("Please enter a number: ");
scanf(" %d",&x);
if(x&mask){
myArray[0]='1';
@toph113
toph113 / Imp Calc
Last active November 7, 2019 11:46
Impedance Calculator (5 cycles)
#include <stdio.h>
#include <conio.h>
#include <math.h>
main(){
float const pi = 4.0 * atan(1.0);
float Z, Xc, Xl, R, f, deg, rad, L, C;
int cntr;
char Ckt;
for(cntr=0;cntr<5;cntr++){
#include <math.h>
#include <stdio.h>
#include <conio.h>
main(){
float cost;
int dist;
printf("Please enter a distance: ");
scanf(" %d",&dist);
if (dist<=100 && dist>0){
cost = 5.00;
#include <math.h>
#include <stdio.h>
#include <conio.h>
main(){
int opCode;
float x, y, sum;
printf("Please enter a value for x: ");
scanf("%f", &x);
printf("\nPlease enter a value for y: ");
scanf("%f", &y);
@toph113
toph113 / gist:8450438
Created January 16, 2014 05:55
Pythagorean Theorem. Was just playing around with some stuff from the end of chapter 2 and the beginning of chapter 3... Too much spare time I guess
#include <stdio.h>
#include <conio.h>
#include <math.h>
main(){
float A, B, C, C2, p=2;
printf("Please enter a value for side A: ");
scanf("%f", &A);
printf("\nPlease enter a value for side B: ");
scanf("%f", &B);
C2 = (A*A + B*B);
@toph113
toph113 / Age Interrigation
Last active January 3, 2016 07:38
Funny age program
#include <stdio.h>
#include <conio.h>
main(){
int age;
printf("Please enter your age: ");
scanf("%d", &age);
printf("\nThe age you lied about is %d", age);
while( !kbhit()){}
}