Algorithm and examination program a number, is the number including a prime number or not
Look Aminah together Amin
Say Bismillah before begin
Hhhmm, we know that a prime number is a number which is not residual zero if devided by numbers instead 1 and it self, for example like this:
Wah, this is just basic theory about what is definition of prime number, understand? understand ya.........? fortunately, if understand we will continue
For example a is number will be examined, is prime number or not, then:
Before make program, first we will make the algorithm, number will be entered certain fulfill one of three conditions below:
For number which smaller than 2, has certain is not prime number, because the prime number started form 2, and for number which larger than 2, then need to next examination, is the number prime number or not, so be obtained algorithm as follow:
If the algorithm above we write in Turbo Pascal Programming Language, then will be obtained syntax as follow, the syntax like what ya? like code below...
uses crt;
var a,b: longint;
begin clrscr;
writeln('PRIME NUMBER EXAMINATION PROGRAM');writeln(#10);
writeln('This program will ask input a number to know is the number prime number or not');
writeln(#10); write('input a number: '); readln(a);
if a<2 then writeln(a,' has certain is not prime number, because prime number started from 2');
For friend who want the pascal file or .pas extension file can download it here, so that don’t need to rewrite in Turbo Pascal program, hehe, ^_^
Result from examination a number pascal programming, prime or not is a application or .exe file which can be downloaded here
The .doc file of this post can be downloaded here
accept my creation, thank you
Look Aminah together Amin
Say Bismillah before begin
Hhhmm, we know that a prime number is a number which is not residual zero if devided by numbers instead 1 and it self, for example like this:
- 7 is a prime number, because 7 only residual zero if devided by numbers 1 and it self
- 11 is a prime number, because 11 only residual zero if devided by numbers 1 and it self
- 8 is not prime number, because instead devided by numbers 1 and 8 self, 8 also residual zero if devided by number 2 and 4
- 15 is not prime number, because instead devided by numbers 1 and 15 self, 15 also residual zero if devided by 3 and 5
Wah, this is just basic theory about what is definition of prime number, understand? understand ya.........? fortunately, if understand we will continue
For example a is number will be examined, is prime number or not, then:
- a is a prime number if and only if a is not residual zero if devided by numbers instead 1 and a self,
- Statement above can be written as follow: a is a prime number if and only if a is not residual zero if devided by numbers 2, 3, ..., a-1
- If we suppose that b = 2, 3, ..., a, then its mean a is a prime number if and only if a mod b = 0 (we continue again yach......)
Before make program, first we will make the algorithm, number will be entered certain fulfill one of three conditions below:
- The number will be entered smaller than 2 (a < 2)
- The number will be entered is 2 (a = 2)
- The number will be entered larger than 2 (a > 2)
For number which smaller than 2, has certain is not prime number, because the prime number started form 2, and for number which larger than 2, then need to next examination, is the number prime number or not, so be obtained algorithm as follow:
If the algorithm above we write in Turbo Pascal Programming Language, then will be obtained syntax as follow, the syntax like what ya? like code below...
uses crt;
var a,b: longint;
begin clrscr;
writeln('PRIME NUMBER EXAMINATION PROGRAM');writeln(#10);
writeln('This program will ask input a number to know is the number prime number or not');
writeln(#10); write('input a number: '); readln(a);
if a<2 then writeln(a,' has certain is not prime number, because prime number started from 2');
if a=2 then writeln(a,' is a prime number');huh the finally finish,
for b:=2 to a-1 do
if a mod b = 0 then
begin
writeln(#10); writeln(a,' is a prime number');
b:=a-1;
end else
begin
if b=a-1 then
begin
writeln(#10); writeln(a,' is not prime number');
end;
end;
readln end.
For friend who want the pascal file or .pas extension file can download it here, so that don’t need to rewrite in Turbo Pascal program, hehe, ^_^
Result from examination a number pascal programming, prime or not is a application or .exe file which can be downloaded here
The .doc file of this post can be downloaded here
accept my creation, thank you
Comments :
0 komentar to “english for 2nd post”
Posting Komentar