Subscribe

RSS Feed (xml)

Friday, October 16, 2009

Write a C program to display the message "Welcome to C" without a Semicolon.

// C program without a Semicolon.
This can done in three ways but one of them is infinite.(ie, while loop)
Solution:1
#include(stdio.h) // note place '<' & '>' in place of '(' & ')'
void main( )
{
if(printf("Welcome to C"))
{
}
}

Solution:2
void main( )
{
swicth(printf("Welcome to C"))
{
}
}

Solution:3
void main( )
{
while(printf("Welcome to C")) //infinite loop
{
}
}

No comments:

Post a Comment