Skip to main content
Add three different solutions.
Source Link
null
  • 12.2k
  • 3
  • 58
  • 93

3.1

Yet another puzzle. But normal solutions are boring, what about something special?

Solution one:

#include <stdio.h>
int main() {
   int i;
   int n = 20;
   for( i = 0; i < n; i++ )
      printf("+");
   return 0;
}

I decided to change ONLY ONE CHARACTER, that is, -. No characters other than - were changed.

Solution two:

#include <stdio.h>
int main() {
   int i=printf("++++++++++++++++++++");exit(0);
   int n = 20;
   for( i = 0; i < n; i-- )
      printf("+");
   return 0;
}

This changes exactly one character - the semicolon after int i into =printf("++++++++++++++++++++");exit(0);.

Solution three:

#include <stdix.h>
int main() {
   int i;
   int n = 20;
   for( i = 0; i < n; i-- )
      printf("+");
   return 0;
}

This loads the stdix.h system header. In the system include path, insert the following file, called stdix.h. It has to contain the following contents.

static inline void printf(const char *string) {
    putsint i;
    for("++++++++++++++++++++"i = 0; i < 20; i--)
        putchar('+');
    exit(0);
}

3.2

Now to insert one letter. Well, that's simple, replace int main() with int main(a). This is not valid according to standards, but who cares?

3.1

Yet another puzzle. But normal solutions are boring, what about something special?

Solution one:

#include <stdio.h>
int main() {
   int i;
   int n = 20;
   for( i = 0; i < n; i++ )
      printf("+");
   return 0;
}

I decided to change ONLY ONE CHARACTER, that is, -. No characters other than - were changed.

Solution two:

#include <stdio.h>
int main() {
   int i=printf("++++++++++++++++++++");exit(0);
   int n = 20;
   for( i = 0; i < n; i-- )
      printf("+");
   return 0;
}

This changes exactly one character - the semicolon after int i into =printf("++++++++++++++++++++");exit(0);.

Solution three:

#include <stdix.h>
int main() {
   int i;
   int n = 20;
   for( i = 0; i < n; i-- )
      printf("+");
   return 0;
}

This loads the stdix.h system header. In the system include path, insert the following file, called stdix.h. It has to contain the following contents.

static inline void printf(const char *string) {
    puts("++++++++++++++++++++");
    exit(0);
}

3.1

Yet another puzzle. But normal solutions are boring, what about something special?

Solution one:

#include <stdio.h>
int main() {
   int i;
   int n = 20;
   for( i = 0; i < n; i++ )
      printf("+");
   return 0;
}

I decided to change ONLY ONE CHARACTER, that is, -. No characters other than - were changed.

Solution two:

#include <stdio.h>
int main() {
   int i=printf("++++++++++++++++++++");exit(0);
   int n = 20;
   for( i = 0; i < n; i-- )
      printf("+");
   return 0;
}

This changes exactly one character - the semicolon after int i into =printf("++++++++++++++++++++");exit(0);.

Solution three:

#include <stdix.h>
int main() {
   int i;
   int n = 20;
   for( i = 0; i < n; i-- )
      printf("+");
   return 0;
}

This loads the stdix.h system header. In the system include path, insert the following file, called stdix.h. It has to contain the following contents.

static inline void printf(const char *string) {
    int i;
    for(i = 0; i < 20; i--)
        putchar('+');
    exit(0);
}

3.2

Now to insert one letter. Well, that's simple, replace int main() with int main(a). This is not valid according to standards, but who cares?

Add three different solutions.
Source Link
null
  • 12.2k
  • 3
  • 58
  • 93

3.1

Yet another puzzle. But normal solutions are boring, what about something special?

Solution one:

#include <stdio.h>
int main() {
   int i;
   int n = 20;
   for( i = 0; i < n; i++ )
      printf("+");
   return 0;
}

I decided to change ONLY ONE CHARACTER, that is, -. No characters other than - were changed.

Solution two:

#include <stdio.h>
int main() {
   int i=printf("++++++++++++++++++++");exit(0);
   int n = 20;
   for( i = 0; i < n; i-- )
      printf("+");
   return 0;
}

This changes exactly one character - the semicolon after int i into =printf("++++++++++++++++++++");exit(0);.

Solution three:

#include <stdix.h>
int main() {
   int i;
   int n = 20;
   for( i = 0; i < n; i-- )
      printf("+");
   return 0;
}

This loads the stdix.h system header. In the system include path, insert the following file, called stdix.h. It has to contain the following contents.

static inline void printf(const char *string) {
    puts("++++++++++++++++++++");
    exit(0);
}

3.1

#include <stdio.h>
int main() {
   int i;
   int n = 20;
   for( i = 0; i < n; i++ )
      printf("+");
   return 0;
}

I decided to change ONLY ONE CHARACTER, that is, -. No characters other than - were changed.

3.1

Yet another puzzle. But normal solutions are boring, what about something special?

Solution one:

#include <stdio.h>
int main() {
   int i;
   int n = 20;
   for( i = 0; i < n; i++ )
      printf("+");
   return 0;
}

I decided to change ONLY ONE CHARACTER, that is, -. No characters other than - were changed.

Solution two:

#include <stdio.h>
int main() {
   int i=printf("++++++++++++++++++++");exit(0);
   int n = 20;
   for( i = 0; i < n; i-- )
      printf("+");
   return 0;
}

This changes exactly one character - the semicolon after int i into =printf("++++++++++++++++++++");exit(0);.

Solution three:

#include <stdix.h>
int main() {
   int i;
   int n = 20;
   for( i = 0; i < n; i-- )
      printf("+");
   return 0;
}

This loads the stdix.h system header. In the system include path, insert the following file, called stdix.h. It has to contain the following contents.

static inline void printf(const char *string) {
    puts("++++++++++++++++++++");
    exit(0);
}
Source Link
null
  • 12.2k
  • 3
  • 58
  • 93

3.1

#include <stdio.h>
int main() {
   int i;
   int n = 20;
   for( i = 0; i < n; i++ )
      printf("+");
   return 0;
}

I decided to change ONLY ONE CHARACTER, that is, -. No characters other than - were changed.