(Source Code) Foxpro - Find Sum/Count of Even/Odd numbers From the 10 numbers entered

Foxpro/VFP Source Codes

Foxpro - Find Sum/Count of Even/Odd numbers
From the 10 numbers entered


 Q : Foxpro - Find Sum/Count of Even/Odd numbers from the 10 numbers entered

Solution:-

clear
i=1
sumeven=0
sumodd=0
te=0
to=0
do while i<=10
input "enter a number :" to n
rem= n % 2
if rem=0
   ?"Even"
    te=te+1
    sumeven=sumeven + n
else
   ?"Odd"
   to=to+1
   sumodd=sumodd + n
endif
i=i+1
enddo

?"Total odd nos are :" , to
?"and their sum is :", sumeven
?"Total even nos are :" , te
?"and their sum is :", sumodd

 



comments powered by Disqus