#include <iostream.h>
#include <stdio.h>
#include <conio.h>
void main()
{
cout<<"<<<<<<<<<<*>>>>>>>>>>>\n";
cout<<"<< Rio Jefri Pasaribu >>\n";
cout<<"<<<<<<<<<<*>>>>>>>>>>>\n";
cout<<endl;
int a, b, c, d, e;
cout<<"===========================================\n";
cout<<"Masukkan Nilai 1 : ";
cin>>b;
cout<<"Masukkan Nilai 2 : ";
cin>>c;
cout<<"===========================================\n";
cout<<"\nBilangan Prima Antara "<<b<<" dan "<<c<<" adalah : \n";
for(a=b+1, e=0;a<c;a++)
{
for(d=a;d>1;d--)
{
if( !(a%d) && a!=d )//bukan bilangan prima
{
goto skip;
}
}
printf("%d, ",a);
e++;
skip:;
}
printf("\r\n\nAda %d\r\n\r\n",e);
getch();
cout<<"===========================================\n";
}
1 komentar:
makasih banyak gan,,,sangat membantu,,,tapi kok gag da keterangannya???jadi agak sulit memahami :)
Posting Komentar