#include <iostream.h>
#include <conio.h>
main()
{
int f, x, cek, i;
cout<<"============================================="<<endl<<endl;
cout<<"PROGRAM MENENTUKAN DERET BILANGAN PRIMA"<<endl<<endl;
cout<<"============================================="<<endl<<endl;
cout<<"Masukan Jumlah : ";
cin>>f;
cout<<endl;
cout<<"Deret Bilangan Prima sampai angka "<<f<<" adalah: "<<endl<<endl;
for(x = 2; x<=f; x++)
{ cek = 0;
for (i = 2; i < x; i++)
{ if (x % i == 0)
{ cek = 1;
}} if (cek == 0)
{ cout<<x<<", ";
}}
{
cout<<endl<<endl<<endl;
}
getch();
}
Program Menampilkan Deret Bilangan Prima Dengan C++
Reviewed by Pak Gulo
on
Mei 28, 2015
Rating:
Mantap gan
BalasHapus