This command is used for the programming in FoxPro.
This command opens a dialog box to type the programs
Syntax:-
Modify command <program name>
(A dialog box will open type the program here)
After typing the program Save the program.
Saving a program
Ctrl+W)
Running a program
do <program name>
modify command sum
clear
a=10
b=15
c=a+b
?”Sum is”,c
Save: Ctrl+wRun : do sum
2) WAP to print the sum average and multiplications of four numbers.
clear
a=20
b=30
c=40
d=50
sum=a+b+c+d
avg=sum/4
mul=a*b*c*d
?”Sum is - ”,sum
?”Average is - ”,avg
?”Multiply is - ”,mul
3) WAP to print the simple interest.
clear
p=1000
r=2
t=12
i=(p*r*t)/100
?”Simple Interest - ”,i
Command line Input/ User input
4) WAP to print the sum of two numbers.
clear
input”Enter A ” to a
input”Enter B ” to b
c=a+b
?”Sum is”,c
5) WAP to print the sum average and multiplications of four numbers.
clear
input”Enter A ” to a
input”Enter B ” to b
input”Enter C ” to c
input”Enter D ” to d
sum=a+b+c+d
avg=sum/4
mul=a*b*c*d
?”Sum is - ”,sum
?”Average is - ”,avg
?”Multiply is - ”,mul
6) WAP to print the simple interest.
clear
input”Enter Principal ” to p
input”Enter Rate ” to r
input”Enter Time ” to t
i=(p*r*t)/100
?”Simple Interest - ”,i
7) WAP to print the area of the circle
clear
input”Enter Radius ” to r
area=3.14*r*r
?”Area of circle is -”,area
8) WAP to print the square and the cube of a number
clear
input”Enter Any Number ” to a
s=a*a
c=a*a*a
?”Square is- ”,s
?”Cube is- ”,c
9) WAP to print the integer part and round fractional part of the number
clear
input“Enter any Number with decimal part” to n
?“Integer Part is”,int(n)
?”The Decimal places round 2 are”,round(n,2)
10) WAP to calculate the employ salary as
Ta=5%
Da=5%
Hra=10%
clear
accept”Enter the name of the employ” to name
input”Enter the Basic Pay” to bs
ta=(bs*5)/100
da=(bs*5)/100
hra=(bs*10)/100
pf=(bs*12)/100
ts=(bs+ta+hra+da)-pf
?”Name”,name
?”Transport Allowance - ”,ta
?”Dearness Allowance - ”,da
?”House Rent Allowance - ”,hra
?”Net Salary - ”,ts
11) WAP to calculate the total marks and percentage of a student.
clear
accept”Enter the Name ” to name
input”English - ” to eng
input”Math - ” to math
input”Science - ” to sc
input”Social Studies - ” to ss
tm=eng+math+sc+ss
per=(tm*100)/400
?”Name - ”,name
?”Total Marks - ”,tm
?”Percentage - ”,per
12) WAP to swap 2 numbers.
clear
input”Enter A” to a
input”Enter B” to b
temp=a
a=b
b=a
?”After Swapping”
?”A = ”,a
?”B = ”,b
13) WAP to swap 2 numbers without using 3rd variable.
clear
input”Enter A” to a
input”Enter B” to b
a=a+b
b=a-b
a=a-b
?”After Swapping”
?”A = ”,a
?”B = ”,b
clear
accept”Enter String” to n
?”Length - ”, len(n)
?”Left 5 Letters”, left(n,5)
?”Right 5 Letters”, right(n,5)
?”Upper Case Letters”, upper(n)
This command opens a dialog box to type the programs
Syntax:-
Modify command <program name>
(A dialog box will open type the program here)
After typing the program Save the program.
Saving a program
Ctrl+W)
Running a program
do <program name>
Simple Programs
1) WAP to print the sum of two numbers.modify command sum
clear
a=10
b=15
c=a+b
?”Sum is”,c
Save: Ctrl+wRun : do sum
2) WAP to print the sum average and multiplications of four numbers.
clear
a=20
b=30
c=40
d=50
sum=a+b+c+d
avg=sum/4
mul=a*b*c*d
?”Sum is - ”,sum
?”Average is - ”,avg
?”Multiply is - ”,mul
3) WAP to print the simple interest.
clear
p=1000
r=2
t=12
i=(p*r*t)/100
?”Simple Interest - ”,i
Command line Input/ User input
4) WAP to print the sum of two numbers.
clear
input”Enter A ” to a
input”Enter B ” to b
c=a+b
?”Sum is”,c
5) WAP to print the sum average and multiplications of four numbers.
clear
input”Enter A ” to a
input”Enter B ” to b
input”Enter C ” to c
input”Enter D ” to d
sum=a+b+c+d
avg=sum/4
mul=a*b*c*d
?”Sum is - ”,sum
?”Average is - ”,avg
?”Multiply is - ”,mul
6) WAP to print the simple interest.
clear
input”Enter Principal ” to p
input”Enter Rate ” to r
input”Enter Time ” to t
i=(p*r*t)/100
?”Simple Interest - ”,i
7) WAP to print the area of the circle
clear
input”Enter Radius ” to r
area=3.14*r*r
?”Area of circle is -”,area
8) WAP to print the square and the cube of a number
clear
input”Enter Any Number ” to a
s=a*a
c=a*a*a
?”Square is- ”,s
?”Cube is- ”,c
9) WAP to print the integer part and round fractional part of the number
clear
input“Enter any Number with decimal part” to n
?“Integer Part is”,int(n)
?”The Decimal places round 2 are”,round(n,2)
10) WAP to calculate the employ salary as
Ta=5%
Da=5%
Hra=10%
clear
accept”Enter the name of the employ” to name
input”Enter the Basic Pay” to bs
ta=(bs*5)/100
da=(bs*5)/100
hra=(bs*10)/100
pf=(bs*12)/100
ts=(bs+ta+hra+da)-pf
?”Name”,name
?”Transport Allowance - ”,ta
?”Dearness Allowance - ”,da
?”House Rent Allowance - ”,hra
?”Net Salary - ”,ts
11) WAP to calculate the total marks and percentage of a student.
clear
accept”Enter the Name ” to name
input”English - ” to eng
input”Math - ” to math
input”Science - ” to sc
input”Social Studies - ” to ss
tm=eng+math+sc+ss
per=(tm*100)/400
?”Name - ”,name
?”Total Marks - ”,tm
?”Percentage - ”,per
12) WAP to swap 2 numbers.
clear
input”Enter A” to a
input”Enter B” to b
temp=a
a=b
b=a
?”After Swapping”
?”A = ”,a
?”B = ”,b
13) WAP to swap 2 numbers without using 3rd variable.
clear
input”Enter A” to a
input”Enter B” to b
a=a+b
b=a-b
a=a-b
?”After Swapping”
?”A = ”,a
?”B = ”,b
Manipulating String with program
WAP to for the string functions.clear
accept”Enter String” to n
?”Length - ”, len(n)
?”Left 5 Letters”, left(n,5)
?”Right 5 Letters”, right(n,5)
?”Upper Case Letters”, upper(n)