Source Code



Program Bilangan Primer

  • Sulaeman Susanto
  • Jul 25' 13
  • C++
  • 56
  • 250
  • Indonesia

Program Bilangan Primer,

ini ni guys kodingnya:

 

     #include "stdio.h"
    #include "conio.h"
    #include "iostream.h"

    void main()
    {
        int a, b, c;
        c=1;a=0;
cout << "====================================================================" <<endl;
cout << "|Welcome to my program                                                                                                   |" <<endl;
cout << "|Sulaeman Susanto                                                                                                           |" <<endl;
cout << "|IT Support KOMINFO (SDPPI)                                                                                             |" <<endl;
cout << "|Support By pasarkode.com                                                                                                |" <<endl;
cout << "====================================================================" <<endl;
        printf("Masukkan Bilangan Prima Yang Ingin Ditampilkan : ");
        scanf("%d",&b);
        for(int i=1; c<=b; i++)
        {
            for(int j=1;j<=i;j++)
            {
                if(i%j==0)
                {
                    a++;
                }
            }
            if(a==2)
            {
                printf(" %d",i);
                c++;
            }
            a=0;
        }
        getch();
    }

 

 

  • Tags :
comments powered by Disqus

Related Code

Bilangan Faktorial

Program Segitiga Bintang

Program Bilangan Rata - Rata

Program menghitung bilangan urut

Membuat program Tahun Kabisat

Tips and Trick using jQuery

Send Email from PHP

Marquee in Delphi

Internet Connection Check

TCP Connection



Category