Created
September 21, 2011 16:35
-
-
Save b-adams/1232568 to your computer and use it in GitHub Desktop.
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> | |
//Eliminating magic numbers 4, 4, 10, 2, 3 | |
//const int ARBITRARY_5=4; | |
const int ARBITRARY_4=4; | |
const int ARBITRARY_3=10; | |
const int ARBITRARY_2=2; | |
const int ARBITRARY_1=3; | |
int getANumber(); | |
int squareIt(int x); | |
int main() | |
{ | |
int x; | |
int y; | |
x=getANumber(); | |
y = x+ARBITRARY_4; | |
y = y * ARBITRARY_4; | |
y = y -ARBITRARY_3; | |
y = y-ARBITRARY_2*x; | |
y = y-ARBITRARY_1; | |
printf("Y is...%d, x was %d\n",y, x); | |
return 0; | |
} | |
int getANumber() | |
{ | |
int x; | |
printf("Enter a number:\n"); | |
scanf("%d",&x); | |
return x; | |
} | |
int squareIt(int x){ return x*x; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment