C-Girilen bir sayının asal sayı olup olmadığını bulan program

Konu sahibi son olarak 3315 gün önce görüldü
Kod:
#include<stdio.h>
#include<conio.h> 
 
int main()
 
{  
 int temp=1,sayi,counter=2,temp2=1;
 
 
    
 printf("Bir sayi giriniz:/n");
 scanf("%d",&sayi);
  
 while(counter<sayi){
  
 temp=sayi%counter;
 counter++;
 if(temp==0)
 temp2=0;
  
 }
  
  
 if(temp2==0)
 printf("Girilen sayi asal degildir.");
 else
 printf("Girilen sayi asaldir.");
 getch();
 return 0;
  
}
 
Geri