// Project38pg146.cpp : Defines the entry point for the console application.

/*This program is to take a number between 0 and 32,767 and print the individual digits

of the number on a line

with three spaces between each digit. each subsequent line will drop the first digit and

print the remaining

digtis with a spacing of three between each digit until there is only one digit on the last

line.

Written by:

Date: 9/10/07 , modified:

*/

#include "stdafx.h"

#define INT_MIN 00000

#define INT_MAX 32767

int _tmain(void)

{

// Local Declarations

int intNum;

int oneDigit;

int twoDigit;

int threeDigit; // # has no more than five digits

int fourDigit;

int fiveDigit;

// Statements

printf("Please enter a integral number between 0 and 32,767 %d: ");

scanf_s("%d", &intNum);

oneDigit=intNum %d / 10000;

twoDigit=intNum %d / 1000;

threeDigit=intNum %d/ 100;

fourDigit=intNum %d/ 10;

fiveDigit=intNum %d/ 1;

printf("%3d%3d%3d%3d%3d\n",

oneDigit,twoDigit,threeDigit,fourDigit,fiveDigit);

printf("%3d%3d%3d%3d\n", twoDigit,threeDigit,fourDigit,fiveDigit);

printf("%3d%3d%3d%\n", threeDigit,fourDigit,fiveDigit);

printf("%3d%3d%\n", fourDigit,fiveDigit);

printf("%3d\n", fiveDigit);

return 0;

}

Click to expand...