Skip to content

Instantly share code, notes, and snippets.

@jamesbcook
Created February 16, 2014 06:25
Show Gist options
  • Save jamesbcook/9030082 to your computer and use it in GitHub Desktop.
Save jamesbcook/9030082 to your computer and use it in GitHub Desktop.
/*
* =====================================================================================
*
* Filename: math_test.c
*
* Description: simple math tests
*
* Version: 1.0
* Created: 02/15/2014 10:55:35 PM
* Revision: none
* Compiler: gcc
*
* Author: b00stfr3ak
*
* =====================================================================================
*/
#include <stdio.h>
//void square(double in);
double square(double in);
double cube(double in);
int main() {
int i;
double sq_final;
printf("Squaring Numbers!\n");
for(i; i <= 2000000; i++) {
//for(i; i <= 10; i++) {
//square(i);
sq_final = square(i);
}
printf("square final %f\n",sq_final);
printf("Cube Numbers!\n");
int x;
double cu_final;
for(x;x<=2000000;x++){
cu_final = cube(x);
}
printf("cube final %f\n",cu_final);
return 0;
}
double square(double in) {
//void square(double in) {
double sq = in * in;
//printf("%f\n",sq);
return sq;
}
double cube(double in){
double cu = in * in *in;
//printf("%f\n",cu);
return cu;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment