Pages

Saturday, September 17

Print a string without using any semicolon

Write a program to print a  string without using any semicolon on the program:


#include<stdio.h>
main()
{
      if(printf("Hello.."))
      {
      }

}




I want to know how this program can modified to print any string accepted through Keyboard..!!

If anyone know, feel free to comment it here..!!  :):):)

6 comments:

  1. #include
    main()
    {
    if(char a[10]){}if(scanf("%s"),&a)){}if(printf("Hello.."))
    {
    }
    }
    will this work??

    ReplyDelete
  2. #include
    #include
    main(char a[10])
    {
    if(scanf("%s",a)){}if(printf("%s",a))
    {
    }
    }
    will this?

    ReplyDelete
  3. it will perform better in turbo c if the code was like this........
    #include
    #include
    main()
    {
    if(printf("Hello.."))
    {
    }
    if(getch())
    {
    }
    }

    ReplyDelete
  4. for reading string through keyboard and displaying without using semicolon ,the code for turbo c++...is
    ------------------------------------------------------
    #include

    void main(char a[10])
    {
    if(printf("Enter string"))
    {}
    if(scanf("%s",a))
    {}
    if(printf("\n you enterd the string\n"))
    {}
    if(puts(a))
    {}
    if(getch())
    { }
    }

    ReplyDelete
  5. @Anonymous
    Nice work Sreenath :)
    Thnx 4 d comment

    ReplyDelete
  6. #include
    main(int argc, char *argv[])
    {
    if(printf("%s",argv[1]))
    {
    }
    }
    ____________________________
    ./a.out
    ____________________________________
    ...............for passing command line arguments,
    swamiji.

    ReplyDelete