Saturday, July 24, 2010

C Program to print your name without using semicolon

I just wondered if I could really write this program. But on rethinking, I found it to be easy. Given below is the C program to print name without using semicolon:


int main()
{
          if(printf("Sai Ravi Kiran \n"))
          {
          }
}


A silly mistake such as omitting the curly braces in the empty "if" block would prove expensive as it is a compilation time error.

11 comments:

  1. #include
    int main()
    {
    char nm[]="ANSWER";
    printf(nm);
    }

    ReplyDelete
    Replies
    1. Your method didn't work at all,
      may be this will help you...

      #include
      #include
      {
      clrscr();
      if(printf("NAME"))
      {
      }
      getch();
      }

      Do Try This..

      Delete
    2. Rakshita maam u have used semicolon in clrscr(); and getch();
      and the objective is to print ur name widout semicolon

      Delete
  2. in above program it will give error bcoz there is no return 0; written so int main is replaced by void main

    ReplyDelete
  3. Your post has really enhanced my understanding thank you. Visit this profile for similar quality content Color Blind Test. These tests measure how well you can distinguish between different colors.

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...