DBASE LESSON6:
EXAMPLE OF DBASE PROGRAMMES
Program 2: Program to Print three times name in single line.
SET TALK OFFSET STATUS OFF
STORE "Asha" to B
?B
??B
??B
Output:
AshaAshaAsha
Program 3: Print the program to add two numbers.
SET TALK OFFSET STATUS OFF
CLEAR
STORE 0 TO A, B, C
INPUT "Enter a Number" to A
INPUT "Enter a Number" to B
C=A+B
?"TOTAL = ",C
Output:
Enter a Number : 5
Enter a Number : 6
TOTAL = 11
Program 4: Print the program to use SQRT function
SET TALK OFFCLEAR
STORE 0 TO A
INPUT "Enter a Number " to A
?SQRT(A)
Output:
Enter a Numer : 9
3
Program 5: Print the program to student details, Total and Average of Student Marks.
SET TALK OFFSTORE SPACE(20) TO NAME, FNAME
STORE 0 TO TEL, HIN, ENG, MAT, SCI, SOC, TOT, AVG
ACCEPT "Enter Student Name:" to NAME
ACCEPT "Enter Student Father Name:" to FNAME
INPUT "Enter Telugu Subject Marks:" to TEL
INPUT "Enter Hindi Subject Marks:" to HIN
INPUT "Enter English Subject Marks:" to ENG
INPUT "Enter Maths Subject Marks:" to MAT
INPUT "Enter Science Subject Marks:" to SCI
INPUT "Enter Social Subject Marks:" to SOC
TOT = TEL+HIN+ENG+MAT+SCI+SOC
AVG=TOT/6
?"STUDENT NAME:",NAME
?"STUDENT FATHER NAME:",FNAME
?"TOTAL MARKS:",TOT
?"AVERAGE:",AVG
Output:
Enter Student Name: Sai
Enter Student Father Name : John
Enter Telugu Subject Marks: 55
Enter Hindi Subject Marks: 60
Enter English Subject Marks: 50
Enter Maths Subject Marks: 45
Enter Science Subject Marks: 50
Enter Social Subject Marks: 40
STUDENT NAME: Sai
STUDENT FATHER NAME: John
TOTAL MARKS:300
AVERAGE: 50
Program 6: Print the program to find out the Biggest of two numbers for IF condition.
SET TALK OFFSTORE 0 TO A, B
INPUT "ENTER A NUMBER" TO A
INPUT "ENTER B NUMBER" TO B
IF A>B
?"A IS BIG"
ELSE
IF A<B
?"B IS BIG"
ELSE
IF A=B .OR. B=A
?"BOTH VALUES ARE SAME"
ENDIF
ENDIF
ENDIF
Output:
ENTER A NUMBER: 5
ENTER B NUMBER: 9
B IS BIG
Program 7: Print 100 Natural numbers Program by using DO WHILE condition.
SET TALK OFFSET STATUS OFF
CLEAR
STORE 0 TO N
DO WHILE N<=100
?N
N=N+1
ENDDO
Output:
Print 1 to 100 Natural Numbers
Program 8: Print the program to length of character, Upper case and Lower case for String.
SET TALK OFFSET STATUS OFF
STORE "Sai Kumar" to S
?LEN(S)
?UPPER(S)
?LOWER(S)
Output:
9
SAI KUMAR
sai kumar
Program 9: Print the Program to Day, Month, Year of Update by using function.
SET TALK OFFSET STATUS OFF
SET DATE BRITISH
?"UPDATE : ", DATE( )
?"DAY : ", DAY(DATE( ) )
?"MONTH : ", MONTH(DATE( ) )
?"YEAR : ", YEAR(DATE( ) )
Output:
UPDATE: 05/09/2018
DAY: 05
MONTH: 09
YEAR: 2018
Program 10: The Program to converts a number into a Character as per ASCII codes.
SET TALK OFFSET STATUS OFF
STORE 0 TO N
DO WHILE N<=255
?CHR(N)
N=N+1
ENDDO
Output:
Print 256 ASCII Character codes.