कंप्यूटर प्रोग्रामिंग/वेरिएबल/बेसिक
दिखावट
(कंप्यूटर प्रोग्रामिंग/चर/बेसिक से अनुप्रेषित)
variables.bas
[सम्पादन | स्रोत सम्पादित करें]PRINT "Variables and Data Types"
DIM I AS INTEGER
DIM L AS LONG
DIM S AS SINGLE
DIM D AS DOUBLE
DIM ST AS STRING
I = 12345
L = 1234567890
S = 1.234567
D = 1.23456789012345
ST = "string"
PRINT "INTEGER:"; I
PRINT "LONG:"; L
PRINT "SINGLE:"; S
PRINT "DOUBLE:"; D
PRINT "STRING: "; ST
PRINT
PRINT "Constants"
CONST PI = 3.14159
CONST C = "Constant"
PRINT PI, C
PRINT
PRINT "Arithmetic Operators"
DIM A AS INTEGER
DIM B AS INTEGER
A = 3
B = 2
PRINT "A ="; A
PRINT "B ="; B
PRINT "A + B ="; A + B
PRINT "A - B ="; A - B
PRINT "A * B ="; A * B
PRINT "A / B ="; A / B
PRINT "A^B ="; A^B
PRINT
PRINT "Assignment Operators"
A += B
PRINT "A += B is"; A
A -= B
PRINT "A -= B is"; A
A *= B
PRINT "A *= B is"; A
A /= B
PRINT "A /= B is"; A
A ^= B
PRINT "A ^= B is"; A
PRINT
PRINT "String Concatenation"
DIM S1 AS STRING
DIM S2 AS STRING
S1 = "Hello"
S2 = "world"
PRINT S1 + " " + S2 + "!"
PRINT
PRINT "User Input"
DIM Username AS STRING
INPUT "What is your name"; Username
PRINT "Hello " + Username + "!"
कोशिश करो
[सम्पादन | स्रोत सम्पादित करें]निम्न कोड मुफ्त ऑनलाइन विकास के वातावरण में से एक में ऊपर कॉपी और पेस्ट करो या अपने खुद के कम्पाइलर/इंटरप्रेटर/आईडीई का उपयोग करें।