Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Number Formatting [Digits(Len), Sum, Reverse Sequence)
Index -> Programming, Turing -> Turing Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
vexd




PostPosted: 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 Razz
+6 bits
[/mod:74faaecfc1]
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: