/* This program separates a five-digit number into its individual digits */
int main (void) {
int number; /* number entered by user */
int placeHolder; /* stores the remainder */
int firstDigit;
int secondDigit;
int thirdDigit;
int fourthDigit;
int fithDigit;
/* Get number from user */
printf("Please enter a five-digit number:\t");
scanf("%d",&number);
/* Separate the digits */
firstDigit = number / 10000; /* getting the first digit */
placeHolder = number % 10000;
secondDigit = placeHolder / 1000; /* getting the second digit */
placeHolder = placeHolder % 1000;
thirdDigit = placeHolder / 100; /* getting the thrid digit */
placeHolder = placeHolder % 100;
fourthDigit = placeHolder / 10; /* getting the fourth digit */
placeHolder = placeHolder % 10;
fithDigit = placeHolder; /* getting the fith digit */
/* Print the digits individually */
system ("cls");
printf(" %d \n %d \n %d \n %d \n %d\n", firstDigit, secondDigit, thirdDigit, fourthDigit, fithDigit);
system("pause");
return 0;
} /* end main function */
Journey To Become A Programmer
Saturday, January 26, 2013
Hello
It's been a while since I've done any C programming so I'm going to start by writing simple programs and hopefully move my way up from there. As time progresses, the programs should steadily become more complex and interesting.
Sunday, January 20, 2013
Introduction
Hi everyone,
Lets begin with a short introduction.
My name is Vanessa and I'm currently a student studying Computer Engineering and Programming. My goal is to learn all that I can and become a good programmer.
I created this blog to chronicle my journey to become a good computer programmer and to talk about anything and everything technology related.
Comments and feedback are always welcome. :)
Subscribe to:
Posts (Atom)