Description:-
In this article we will see about how to get prime Number from 1 to 10000. It’s little difficult to get. Here I have used progress bar to get prime number for little display information while counting prime number between those two numbers what we have set for from to to in code. Here I have used progress bar for information it counting the prime number and after done it will display information in Infolog window. In Progressbar it pretty easy to set and we can set animation in Progressbar to display in windows. Here is the simple Job code to Used Progressbar in Ax.
Code:-
Static void Progress_PrimeNumber(Args _args) { #avifiles booleancheckPrime,_showProgess = true; SysOperationProgressprogressBar = newSysOperationProgress(); intcounter,out; ; counter = 1; out = 10000; while(counter < out) { checkPrime = ((counter mod2)!=0&& (counter mod3) !=0); if(checkPrime) { info(strfmt("its a prime number %1",counter)); } progressBar.incCount(); progressBar.setCaption(strfmt("Generating the prime number for %1",counter)); progressBar.setAnimation(#aviUpdate); //#AviFindFile); //progress.setAnimation(#AviTransfer); progressBar.setText(strfmt("Processing %1 out of %2",counter,out)); counter++; progressBar.update(true); } }
Thanks for comments.....