COME ON CODE ON

A blog about programming and more programming.

Programs without semicolons?

with 10 comments

Let’s have a little fun. First of all try to write a C code to print Hello World! without using semicolons. Here’s the answer in C

#include <stdio.h>
int main()
{
    if (printf("Hello World!\n")) {}
}

or if you are a hardcore C++ fan then
#include
int main()
{
if (std::cout << "Hello world!" << std::endl) {} }[/sourcecode] But the real gem is the following program. A program to find the factorial of a number. [sourcecode language='cpp']#include
int main(int n)
{
if (std::cin>>n)
{
if (int f=1 )
{
while (n != 1)
{
if ( f = n * f )
{
if (–n){}
}
}
if(std::cout<<"fac = "<

Advertisements

Written by fR0DDY

July 21, 2009 at 9:35 PM

Posted in Beautiful Codes

Tagged with , , ,

10 Responses

Subscribe to comments with RSS.

  1. josss intuition buddy !
    simply awesome 😀

    Tausiq

    July 29, 2009 at 12:46 PM

  2. this is working

    cijo

    July 7, 2010 at 12:30 AM

  3. alert(“Hello world, Welcome to ‘comeoncodeon’)

    H4CK3R

    April 3, 2011 at 4:33 AM

  4. WOW!!

    Tafhim

    April 10, 2011 at 12:42 PM

  5. hello sir, i want a program in c of multiplication of 2 numbers without using operator.

    shashikant poonia

    March 18, 2012 at 8:26 AM

  6. excuse me guys…can u help me in giving a code to print anumber 100 times without using semicolon???? please its quite urgent……….

    pavan

    July 3, 2012 at 7:13 PM

  7. write a prgm in c++ without using semicolon in c++
    which header file is ” #include

    raja

    November 19, 2012 at 6:02 PM

  8. how would you use return 0 in this program without semicolon?

    Rohit Rawat

    October 21, 2013 at 9:13 PM

  9. can u write a code for reading a variable(like of datatype int) and print that value without semicolon?

    Hari Kiran Vusirikala

    November 23, 2016 at 11:11 PM


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: