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 :

Slimshady said... Best Blogger Tips [Reply to comment] Best Blogger Templates

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

Slimshady said... Best Blogger Tips [Reply to comment] Best Blogger Templates

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

Anonymous said... Best Blogger Tips [Reply to comment] Best Blogger Templates

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

Anonymous said... Best Blogger Tips [Reply to comment] Best Blogger Templates

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())
{ }
}

v!p!n said... Best Blogger Tips [Reply to comment] Best Blogger Templates

@Anonymous
Nice work Sreenath :)
Thnx 4 d comment

Anonymous said... Best Blogger Tips [Reply to comment] Best Blogger Templates

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

Post a Comment