contoh pascal : mencari bilangan prima

5,781 views

Published on

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
5,781
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
27
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

contoh pascal : mencari bilangan prima

  1. 1. uses wincrt;var a,b,c,d,e:longint;begin clrscr;write(‘Input Bilangan Prima Sampai Nilai : ‘); readln(c);writeln(’2′:7);for a:=3 to c dobeginfor b:= 2 to a-1 dobeginif a mod b = 0 then begind:=a ; end else begin e:=a; end;end;if a=d thenbeginb:= a-1;end elsewriteln(e:7);end;end.

×