0% found this document useful (0 votes)
3 views1 page

4-Digit Integer Place Value Algorithm

The document outlines the steps for an algorithm that takes a 4-digit integer as input from the user, calculates the thousands, hundreds, tens, and ones place values using division and modulus operators, and displays the results. It first declares variables, outputs identifying information, prompts the user for their name and integer input, calculates and stores the place values in variables, and lastly displays the place values.

Uploaded by

Connor Griggs
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

4-Digit Integer Place Value Algorithm

The document outlines the steps for an algorithm that takes a 4-digit integer as input from the user, calculates the thousands, hundreds, tens, and ones place values using division and modulus operators, and displays the results. It first declares variables, outputs identifying information, prompts the user for their name and integer input, calculates and stores the place values in variables, and lastly displays the place values.

Uploaded by

Connor Griggs
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Connor Griggs

CSCE 1030 sec.002


09/09/15
Homework 1 Algorithm
1) First, declare variables for the users name, the positive integer to input, and the
four place values that will output.
-Ex. Variable names- name, integer, thousands, hundreds, tens, ones
2) Second, output the programmers information using a block format.
3) Prompt the user to enter their name and output a greeting with their name.
4) Prompt the user to input a positive, 4-digit integer, and store it in a variable.
5) Calculate the place values of the integer using division and modulus operators,
and store the calculations in the place value variables. Use the modulus operator
to take the previous calculations remainder, and assign the integer variable with
the new integer update.
-

Integer/1000, integer%1000
Integer/100, integer%100
Integer/10, integer%10
integer/1

6) Lastly, display the calculated place values by placing each place value variable
in a statement.
7) Compile and run.

You might also like