Herkese selamlar. C'de , Pozitif mi negatif mi , pozitif ise asal mı değil mi diye sorgulatacam da rica etsem yardımcı olabilir misiniz, hata nerede acaba ?
#include<locale.h>
#include<conio.h>
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
main(){
setlocale(LC_ALL,"Turkish");
int ts,i,kontrol=0;
srand(time(0));
ts=rand()%79+12;
for(i=1;i<ts;i++)
{
if(ts%i==0)
{
kontrol=1;
}
}
if((ts>1)&&(kontrol==0))
{
printf("Tahmin edilen sayı %i Bu sayı POZİTİF ve ASAL bir sayıdır",ts);
}
else if(ts>1)
{
printf("Tahmin edilen sayı %i Bu sayı POZİTİF bir sayıdır",ts);
}
else{
printf("Tahmin edilen sayı %i Bu sayı NEGATİF bir sayıdır",ts);
}
getch(); return 0;
}