Archive for FoxPro/VFP

Foxpro – Calculate and Print the Multiplication Table of a Number Entered

Q : Foxpro –  Calculate and Print the Multiplication Table of a Number entered

Solution:

ans=”y”

do while ans=”y”

                clear

                input “enter the table to print :” to t

                i=1

                do while i <=10

                                p=t*i

                                ?str(t)+ “  *” + str(i,4) + “  = ” + str(p,4)

                                i=i+1

                enddo

                accept “want to print another table :” to ans

enddo

 

Leave a Comment

Foxpro – Function for finding Sum of Digits

Function for finding Sum of digit 

Solution:

function sumdigit

para num

sum=0

num=alltrim(str(num))

 

lgt=len(num)

i=1

do while i <= lgt

            s=substr(num,i,1)

            sum=sum+val(s)

            i=i+1

enddo

return sum

Leave a Comment

Programme to convert ritu kamal agrwal to R.K. agrwal

Programme to convert ritu kamal agrwal to R.K. agrwal

clear

accept “enter name” to nm

 

nm = alltrim(nm)

 

cntSPace= occurs(” “,nm)

 

res=””

a=0

for i=1 to cntSPace

            res=res + substr(nm,a+1,1) + “. ”

            a = at(” “,nm,i)

            ?”a”,a

endfor

res=res + substr(nm,a)

?”result is : ” + res

Leave a Comment

Older Posts »