Showing posts with label prime number checker in visual foxrpo. Show all posts
Showing posts with label prime number checker in visual foxrpo. Show all posts

Friday, February 23, 2018

Prime Number Checker in Visual Foxpro


A simple program that I wrote using Microsoft Visual Foxpro 9 that will ask the user to give a number and then our program will check if the given number is a Prime or Not a Prime Number. The code is very easy to understand and use.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.




Sample Program Output


Program Listing



Object: Form1    Procedure: Init
==============

thisform.txtvalue.Value=0

Check Button
=============
Object: Command1    Procedure: Click

 IF  empty(thisform.txtvalue.Value) 
     MESSAGEBOX("Can't be empty")
     thisform.txtvalue.Value=0
     thisform.txtvalue.SetFocus
     RETURN .t.
  ENDIF
  
  
  a=0
  for i=thisform.txtvalue.value to 1 step -1
  if MOD(thisform.txtvalue.value,i)=0
  a=a+1 
  ENDIF
  endfor
 
 if a=2 AND a#1
  display_result="The given number " + transform(thisform.txtvalue.value)+" is a Prime number."
  else
   display_result="The given number " +transform(thisform.txtvalue.value)+" is not a Prime number"
  endif
  thisform.label2.Caption = display_result
  
  
Check Button
==================
Object: Command2    Procedure: Click

 thisform.label2.Caption=""
 thisform.txtvalue.Value=0
 thisform.txtvalue.setfocus

 Quit Button
==================
Object: Command3    Procedure: Click

thisform.release