Skip to content

Instantly share code, notes, and snippets.

@ozkanozcan
Created October 30, 2011 18:06
Show Gist options
  • Save ozkanozcan/1326201 to your computer and use it in GitHub Desktop.
Save ozkanozcan/1326201 to your computer and use it in GitHub Desktop.
//kullanıcıdan 10 sayı alacağız sadece negatifleri diziye atacağız.ve diziyi yazdırcağız
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
//kullanıcıdan 10 sayı alacağız sadece negatifleri diziye atacağız.ve diziyi yazdırcağız
NSArray * dizi = [[NSArray alloc] init];
for(int i = 0; i<10; i++)
{
NSLog(@"Bir sayı giriniz");
int sayi;
scanf("%i",&sayi);
if(sayi<0){
dizi = [dizi arrayByAddingObject:[@"" stringByAppendingFormat:@"%i",sayi]];
}
}
NSLog(@"%@",dizi);
[pool drain];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment