Number Formatting [Digits(Len), Sum, Reverse Sequence)
Author |
Message |
vexd
|
Posted: Mon Sep 29, 2003 6:37 pm Post subject: Number Formatting [Digits(Len), Sum, Reverse Sequence) |
|
|
%***********************************************************************************************
%* Author: VeXD *
%* Date: Sept, 24 2003 *
%* Purpose: Make a prog that will print the number of digits, the sum and the num in reverse. *
%* Input: A number (int) *
%* Output: The program will output the above values *
%***********************************************************************************************
var intNum : int
var intReverse : int
var intSum : int := 0
var intLen : int := 0
put "Please enter a positive number."
get intNum
loop
exit when intNum > 0
put "Please enter a VALID positive number."
get intNum
end loop
put "--->"
put "Reverse Sequence: " ..
loop
intReverse := intNum mod 10
intNum := intNum div 10
intLen := intLen + 1
intSum := intSum + intReverse
put intReverse ..
exit when intNum = 0
end loop
put "\nNumber of Digits: ", intLen
put "Total Sum: ", intSum
[mod:74faaecfc1="Dan"]
Intresting progame, have some bits
+6 bits
[/mod:74faaecfc1] |
|
|
|
|
|
Sponsor Sponsor
|
|
|
|
|