Girilen sayının asal mı? Asal değil mi? bulan C++ Kodları (1 Viewer)

KuQ

Joined
Sep 14, 2020
Credits
28
Rating - 0%
C++:
#include<iostream>

using namespace std;

int main()
{
  int sayi;
  int sayac=0;
  cout<<"BIR SAYI GIRINIZ:";

  cin>>sayi;

for(int j=2; j<sayi; j++)
     {
      if(sayi % j == 0)
         {
          sayac++;
          break;
         }
     }
  if(sayac == 0)
     {
      cout<<"ASALDIR."<<endl;
     }
else
      cout<<"ASAL DEGILDIR."<<endl;
}
 

Users who are viewing this thread

Top