User:Masterhomer/Sandbox

/* Assignment 1 * Introduction to C * Instructor: Joy Woodworth * * Code by: Jonathan Ben-Joseph * * Description: * Separates all character elements of an inputted string by three spaces and prints * the result. * * Compiles with: gcc, MSVC++ 2005 */

// include standard I/O library
 * 1) include 

// define the array size (maximum digits the user may input)
 * 1) define MAX_DIGITS 1000

int main {	// declare variables int increment = 0;			// the increment variable for the loop

static char input_number[MAX_DIGITS];	// note: input_number is declared as static // to prevent garbage data from entering // the result.

// prompt user for information printf("Please enter a number up to %d digits: ", MAX_DIGITS); scanf(" %s", &input_number);

// display the result printf("\nResult:\n");

// loop prints all user entered data with three spaces // in between them. loop stops when it sees NULL in // the array. while(input_number[increment]) {		printf("%c  ", input_number[increment]); increment++; }	// exit application with no errors return 0; }