Go4Expert

Go4Expert (http://www.go4expert.com/)
-   $1 Daily Competition (http://www.go4expert.com/contests/daily-competition/)
-   -   Shortest Hello G4EF | 8 Sep 2009 (http://www.go4expert.com/contests/shortest-hello-g4ef-8-sep-2009-t19348/)

shabbir 8Sep2009 16:46

Shortest Hello G4EF | 8 Sep 2009
 
Write a C Program which has least number of characters and prints "Hello G4EF" without quotes.

This is not first submission winner but would wait for all submission and then the shortest would win.
Criteria would be least number of characters and it should be a C Program

Mridula 8Sep2009 16:55

Re: Shortest Hello G4EF | 8 Sep 2009
 
#include<stdio.h>
main()
{puts("Hello G4EF");}

Kshiteej 8Sep2009 16:57

Re: Shortest Hello G4EF | 8 Sep 2009
 
char*_="Hello G4EF\n";

SaswatPadhi 8Sep2009 18:45

Re: Shortest Hello G4EF | 8 Sep 2009
 
I googled and found this as the shortest possible. As, the source file is only 1 byte !

Steps :
(1) Create a new empty file named : "void main(){puts(Hello, World!);}c.c"
(2) Open the file with any text editor and write only one char "A" to the file and save it.
##That's our program ;) Only 1 char content !
(3) To compile it, use gcc with flags "-DA=__FILE__ -Dc=// -istdio.h void*.c".

Not sure if it works. I'll test and post. :)

Seema786 9Sep2009 07:54

Re: Shortest Hello G4EF | 8 Sep 2009
 
char*_="Hello G4EF";

naimish 9Sep2009 08:12

Re: Shortest Hello G4EF | 8 Sep 2009
 
@ Shabbir,

Are you consider character in file or size of the file ?

shabbir 9Sep2009 09:26

Re: Shortest Hello G4EF | 8 Sep 2009
 
Quote:

Originally Posted by naimish (Post 57088)
@ Shabbir,

Are you consider character in file or size of the file ?

Can you explain the difference.

naimish 9Sep2009 10:07

Re: Shortest Hello G4EF | 8 Sep 2009
 
1. Charater

#include<stdio.h>
main()
{puts("Hello G4EF");}

Total Character = 48

2.

#include<stdio.h>
main()
{puts("Hello G4EF");}

Save It = 4 KB

Raj08 9Sep2009 11:19

Re: Shortest Hello G4EF | 8 Sep 2009
 
Hello G4EF

Output of C Program.

xpi0t0s 9Sep2009 14:26

Re: Shortest Hello G4EF | 8 Sep 2009
 
Quote:

Originally Posted by naimish (Post 57097)
Save It = 4 KB

That's because the file is stored in blocks, and the smallest block size is 4KB. Select the file and press Alt-Enter and you'll see the actual file size displayed.

Quote:

Originally Posted by Raj08
Output of C Program.

Very good. And what is the source code of that C program? It's true Shabbir didn't actually say "and post the code here", but that could reasonably be implied, also how is he going to judge your code if he can't see it?


All times are GMT +5.5. The time now is 19:14.