#import <Foundation/Foundation.h>
int isPrime(int n)
{
int i;
if(n==1||n==2)
return 0;
for(i=3;i<=n/2;i++)
if(n%i==0)
return 0;
return 1;
}
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int i;
for(i=1;i<=100;i++)
{
if(isPrime(i)==1)
NSLog (@"%d is Prime number,",i);
else
NSLog (@"%d is not Prime number,",i);
}
[pool drain];
return 0;
}
int isPrime(int n)
{
int i;
if(n==1||n==2)
return 0;
for(i=3;i<=n/2;i++)
if(n%i==0)
return 0;
return 1;
}
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int i;
for(i=1;i<=100;i++)
{
if(isPrime(i)==1)
NSLog (@"%d is Prime number,",i);
else
NSLog (@"%d is not Prime number,",i);
}
[pool drain];
return 0;
}