Program Prima Bersarang Menggunakan Dev C++
Program Prima Bersarang Menggunakan Dev C++:
#include <stdio.h>
#include <conio.h>
int main ()
{
int i=10,b,a,bilprima;
printf ("awal: ");
scanf("%d", &b);
printf (" akhir: ");
scanf("%d", &b);
for(i=10; i<=30 ; i++)
{
bilprima = 0;
for(a=2; a<=i-1; a++)
{
if(i%a==0)
bilprima=1;
}
if(bilprima == 0 &&i!=13)
printf("%d, " ,i);
}
getch();
}
#include <stdio.h>
#include <conio.h>
int main ()
{
int i=10,b,a,bilprima;
printf ("awal: ");
scanf("%d", &b);
printf (" akhir: ");
scanf("%d", &b);
for(i=10; i<=30 ; i++)
{
bilprima = 0;
for(a=2; a<=i-1; a++)
{
if(i%a==0)
bilprima=1;
}
if(bilprima == 0 &&i!=13)
printf("%d, " ,i);
}
getch();
}
Komentar
Posting Komentar