Skip to content

Instantly share code, notes, and snippets.

@b-adams
Created September 21, 2011 16:35
Show Gist options
  • Save b-adams/1232568 to your computer and use it in GitHub Desktop.
Save b-adams/1232568 to your computer and use it in GitHub Desktop.
#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