Thursday 26 January 2012

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>
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