Skip to content

Instantly share code, notes, and snippets.

@sergiosvieira
Last active December 19, 2015 14:18
Show Gist options
  • Save sergiosvieira/5968029 to your computer and use it in GitHub Desktop.
Save sergiosvieira/5968029 to your computer and use it in GitHub Desktop.
Multiples of 5, 7 and 35
#import <Foundation/Foundation.h>
/**
Author: Sérgio Vieira - sergiosvieira@gmail.com - 2013
**/
int main(int argc, char *argv[]) {
@autoreleasepool {
NSUInteger max = 100;
for (NSUInteger i = 1; i <= max; i++)
{
if (i % 35 == 0)
{
printf("DasDad");
}
else if (i % 5 == 0)
{
printf("Das");
}
else if (i % 7 == 0)
{
printf("Dad");
}
else
{
printf("%ld", i);
}
if (i < max)
{
printf(",");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment