The question was quite simple. It asked to print Something without using semi colon. Is It really possible ? Because semi colon acts as the line terminator in the C and C++. And if not used compiler would give an error.

BUT IT IS POSSIBLE

And I have done so and I am here to tell U how I did it with proper explanation.Do you know that every predifined function in header files always return something. This Concept makes the base of our program. I can guess that U also know the fact that unlike Java, C takes all the values of integers even the negative numbers as true  EXCEPT 0. So, If we put a number as shows

int a=-1;

if(a)

printf(“TRUE”);

else

printf(“FALSE”);

It will print TRUE as -ve numbers are also treated true. But If U have declared a as 0 FALSE will be print. You Can Cheak it by yourself.

I gave U a lecture about If and Return values of predefined functions because these concepts are necessary for U to solve the given problem.

Now, lets Come to the solution of the problem.

Fallowing Code will print your Name

int main()

{

if(printf(“NAME”))

return 1;

}

You may wonder how it could work, Then Let me tell U, printf() always return 1 when it has successfully printed somthing. So, Your code actully becomes

if(1)

printf(“NAME”);

Now, I can Consider that U got the way to solve the problem.

Advertisements