English
Forum

Zahlenstelle Dezimalzahl

 

Jörg
Sellmeyer
I wanted to time mathematically each Zahlenstellen of/ one given number herausbekommen.
the  [...]  was my first Ansatz.

The second was then already erfolgreicher:
SubProc Get.1

    Parameters Zahl&
    Return (Zahl& Mod 10)

ENDPROC

SubProc Get.10

    Parameters Zahl&
    Return ((Zahl& Mod 100) - (Zahl& Mod 10)) \ 10

ENDPROC

SubProc Get.100

    Parameters Zahl&
    Return ((Zahl& Mod 1000) - (Zahl& Mod 100)) \ 100

ENDPROC

SubProc Get.1000

    Parameters Zahl&
    Return ((Zahl& Mod 10000) - (Zahl& Mod 1000)) \ 1000

ENDPROC

Print "34567 many Einzelfunktionen"
Print Get("1",34567)
Print Get("10",34567)
Print Get("100",34567)
Print Get("1000",34567)
Print
WaitInput

SubProc Get.number

    ' index indicate as 1 or 2, 3 etc.
    Parameters Ind%,Zahl&
    Declare tmp1&,tmp2&,tmp3&
    tmp1& = 10^Ind%
    tmp2& = 10 ^(Ind%-1)
    Return ((Zahl& Mod tmp1&) - (Zahl& Mod tmp2&)) \ tmp2&

ENDPROC

'the can ad infinitum weiteführen or a felexible procedure from it make
'The number hinten, so one in a Headerdatei z. B tenner( = Get("Zahl",2,; define can
Print "34567 Flexible Funktion"

WhileLoop 4

    Print Get("Zahl",&Loop,34567),

Wend

Print
WaitInput
'or integrally brachial as Stringauswertung
'has whom benefit, that one discretionary large numbers transfer can

Proc ZahlenStelle

    Parameters number$,index%
    Return Mid$(number$,-index%,1)

ENDPROC

Print
Print "144545678844356 Auswertung as String"

WhileLoop 13

    Print ZahlenStelle(144545678844356,&Loop),

Wend

Print
Print "Auch andersherum"

WhileLoop 13

    Print ZahlenStelle(144545678844356,-&Loop),

Wend

WaitInput
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
05/24/18  
 




jacdelad
tmp1& can itself even save and tmp3& becomes eh not using:
SubProc Get.number

    ' index indicate as 1 or 2, 3 etc.
    Parameters Ind%,Zahl&
    Declare tmp2&
    tmp2& = 10 ^(Ind%-1)
    Return ((Zahl& Mod (10^Ind%)) - (Zahl& Mod tmp2&)) \ tmp2&

ENDPROC

 
05/14/19  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

3.896 Views

Untitledvor 0 min.
Uwe Lang11/01/24
N.Art11/18/20
iF10/31/20
Jörg Sellmeyer06/24/20
More...

Themeninformationen

this Topic has 2 subscriber:

jacdelad (1x)
Jörg Sellmeyer (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie