Middle three digits: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 675: | Line 675: | ||
Press any key to continue...</pre> |
Press any key to continue...</pre> |
||
==={{header|IS-BASIC}}=== |
|||
<lang IS-BASIC>100 INPUT PROMPT "Number: ":N |
|||
120 PRINT MIDDLE$(N) |
|||
130 DEF MIDDLE$(N) |
|||
140 LET N$=STR$(ABS(N)) |
|||
150 IF LEN(N$)<3 THEN LET MIDDLE$="Not enough digits":EXIT DEF |
|||
160 IF MOD(LEN(N$),2)=0 THEN LET MIDDLE$="Even number of digits":EXIT DEF |
|||
170 LET P=(LEN(N$)-3)/2 |
|||
180 LET MIDDLE$=N$(P+1:P+3) |
|||
190 END DEF</lang> |
|||
==={{header|PureBasic}}=== |
==={{header|PureBasic}}=== |