Jump to content

Hello world

This 9 line C program

#include <stdio.h> 
 main(){ int a,b,c;int count = 1; for (b = c = 10; a = "- FIGURE?, UMKC,XYZHello Folks,\ 
      TFy!QJu ROo TNn(ROo)SLq SLq ULo+\ 
      UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\ 
      NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\ 
      HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\ 
      T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\ 
      Hq!WFs XDt!"[b+++21]; ) 
       for(; a-- >64 ; ) putchar ( ++c=='Z' ? c = c/ 9:33^b&1); return 0; } 
To run program in linux terminal type

gcc filename.c  
./a.out 


The output is this Map of India.

Spoiler

                    !!!!!! 
                    !!!!!!!!!! 
                     !!!!!!!!!!!!!!! 
                       !!!!!!!!!!!!!! 
                     !!!!!!!!!!!!!!! 
                      !!!!!!!!!!!! 
                      !!!!!!!!!!!! 
                        !!!!!!!!!!!! 
                        !!!!!!!! 
                        !!!!!!!!!! 
                       !!!!!!!!!!!!!! 
                     !!!!!!!!!!!!!!!! 
                    !!!!!!!!!!!!!!!!                                  !!!!! 
                  !!!!!!!!!!!!!!!!!!!                               !!!!!!!!!! 
                 !!!!!!!!!!!!!!!!!!!!!!!                 !         !!!!!!!!!! 
            !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!              !!     !!!!!!!!!!!! 
           !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!        !!      !!!!!!!! 
            !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
             !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!! 
              !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  !!!!!!!!!!!! 
       !!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!        !!!!!! 
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!      !!!!! 
          !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!        !!! 
        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!        ! 
          !!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
           !!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
                  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
                 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
                  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
                  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
                  !!!!!!!!!!!!!!!!!!!!!!!!!!!! 
                  !!!!!!!!!!!!!!!!!!!!!!!!!! 
                  !!!!!!!!!!!!!!!!!!!!!!!!! 
                   !!!!!!!!!!!!!!!!!!!!!!!! 
                    !!!!!!!!!!!!!!!!!!!! 
                    !!!!!!!!!!!!!!!!!!! 
                     !!!!!!!!!!!!!!!! 
                      !!!!!!!!!!!!!!!! 
                      !!!!!!!!!!!!!!! 
                       !!!!!!!!!!!!!! 
                        !!!!!!!!!!!! 
                        !!!!!!!!!!!! 
                        !!!!!!!!!!!! 
                          !!!!!!!! 
                          !!!!!! 
                           !!!! 


Note: This is not my creation, this was submitted as entry to The International Obfuscated C Code Contest.

 

Is it amazing naah??? Can anybody do that? make your country map and share the code bellow the comment section.

Edited by LogicalDrm
Added code tags and spoiler for results
Link to comment
https://linustechtips.com/topic/1461990-is-c-program-amazing-or-not/
Share on other sites

Link to post
Share on other sites

7 hours ago, Dat Guy said:

 

Writing code that is hard to read, hard to understand and hard to debug is retarded.

I would agree, if not for this:

On 10/19/2022 at 2:12 AM, neerajkirola said:

this was submitted as entry to The International Obfuscated C Code Contest.

 

The whole point of the challenge is to write obfuscated code. Which in my opinion makes it pretty neat.

If your question is answered, mark it so.  | It's probably just coil whine, and it is probably just fine |   LTT Movie Club!

Read the docs. If they don't exist, write them. | Professional Thread Derailer

Desktop: i7-8700K, RTX 2080, 16G 3200Mhz, EndeavourOS(host), win10 (VFIO), Fedora(VFIO)

Server: ryzen 9 5900x, GTX 970, 64G 3200Mhz, Unraid.

 

Link to post
Share on other sites

That's nothing special to C, here's the same program transliterated into java

class Main {
  public static void main(String[] args) {
     int a, b,c; for (b = c = 10; (a = ("- FIGURE?, UMKC,XYZHello Folks,"+
      "TFy!QJu ROo TNn(ROo)SLq SLq ULo+"+
      "UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^"+
      "NBELPeHBFHT}TnALVlBLOFAkHFOuFETp"+
      "HCStHAUFAgcEAelclcn^r^r\\tZvYxXy"+ 
      "T|S~Pn SPm SOn TNn ULo0ULo#ULo-W"+
      "Hq!WFs XDt!").getBytes()[b+++21]) > 0; ) 
       for(; a-- >64 ; ) System.out.print( (char)(++c=='Z' ? c = c/ 9:33^b&1));
  }
}

(it does throw at the end rather than exiting cleanly, but addressing that would require a bit more refactoring, and it does print the same map first). It requires two type conversions, but otherwise looks the same.

 

It's a bit obfuscated, but it's just encoding the number of !s to print in the char codes.

HTTP/2 203

Link to post
Share on other sites

3 hours ago, colonel_mortis said:

(it does throw at the end rather than exiting cleanly

ftfy

Spoiler
public static void main(final String[] args) {
    int a, b, c;
    for (b = c = 10; (a =("- FIGURE?, UMKC,XYZHello Folks," +
            "TFy!QJu ROo TNn(ROo)SLq SLq ULo+" +
            "UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^" +
            "NBELPeHBFHT}TnALVlBLOFAkHFOuFETp" +
            "HCStHAUFAgcEAelclcn^r^r\\tZvYxXy" +
            "T|S~Pn SPm SOn TNn ULo0ULo#ULo-W" +
            "Hq!WFs XDt!")
            .getBytes()[b+++0x1_5])> 0&&b <0b10_1101_00;)
        while (a --> 64) System.out.print((char) (++c == 'Z' ? c/= 9:33 ^ b&1));
}

 

And here's the same code converted to Kotlin

fun main() {
    val s = """
        |- FIGURE?, UMKC,XYZHello Folks,
        |TFy!QJu ROo TNn(ROo)SLq SLq ULo
        |+UHs UJq TNn*RPn/QPbEWS_JSWQAIJ
        |O^NBELPeHBFHT}TnALVlBLOFAkHFOuF
        |ETpHCStHAUFAgcEAelclcn^r^r\tZvY
        |xXyT|S~Pn SPm SOn TNn ULo0ULo#U
        |Lo-WHq!WFs XDt!""".trimMargin()

    val xor = intArrayOf(0, 0, 0b10_10).also { it[1] = it[2] }
    while (s.filter { `n != n` -> `n != n` != '\n' } [xor[1]+++0x1_5].also { xor [0]=it .code} > '\u0000' && xor[1].toChar() < '\u00b4')
       while(xor [0] --> 64) print(Char(if (++xor [2] == 'Z'.code) 9.let { and -> xor[2] /= and; xor[2] } else 33 xor (xor [1] and 1)))
}

 

Remember to either quote or @mention others, so they are notified of your reply

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×