C program to print hello world without using semicolon







C program to print hello world without using semicolon


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

Solution: 2

#include<stdio.h>
void main(){
    while(!printf("Hello world")){
    }
}

Solution: 3

#include<stdio.h>
void main(){
    switch(printf("Hello world")){
    }
}





10. Write a c program to add two numbers without using addition operator.
11. Write a c program to subtract two numbers without using subtraction operator.
15. Write a c program to solve quadratic equation.
18. Write a c program which passes structure to function.
28. Write a c program which takes password from user.
29. Write a scanf function in c which accept sentence from user.
30. Write a scanf function in c which accept paragraph from user.

34 comments:

parthi said...

what is the code for following pattern
1 2 3 9 4 5 6 18 7 8 9 27...

parthi said...

what is the code for following pattern
1 2 3 9 4 5 6 18 7 8 9 27...

Unknown said...

#include

int main(void)
{
int n=9, i;

for(i=1; i<=9; i++)
{
printf("%d ", i);
if(i%3==0)
printf("%d ", i*3);
}
printf("\n");

return 0;
}

Anonymous said...

a. words in the sentence should be even.
b.swap first word from last word and also swap alternate word from end.

input : I am responsible for what I say and I am not responsible for what I understand

output : Understand am what for responsible I am and I say not what for responsible you I .

Pratik Chaudhari said...

write a program to display following putput- USE FOR LOOP.
12345
1234
123
12
1

-pratikc003@gmail.com

Unknown said...

#include

int main(void)
{
int i,j;

for(i=5; i>0; i--)
{
for(j=1; j<=i; j++)
{
printf("%d",j);
}
printf("\n");
}
return 0;
}

Anonymous said...

printf("1 2 3 9 4 5 6 18 7 8 9 27...");
/* Guess who just got OWNED

Anonymous said...

Good one!!!
I did thought this one but not so cleanly...

Meher said...

#include
#include
int main(int argc, const char * argv[])
{

int i,n;
printf("Enter n");
scanf("%d",&n);

for(i=1;i<=n;i++)
{
printf("%d ",i);
if(i%3==0)
printf("%d ",i*3);
}
return 0;
}

Unknown said...

code for it.
h
he
hel
hell
hello

Unknown said...

give me the code of file reading and finding no of line and char

Anonymous said...

why is the condition true for if(printf("Hi"))? like why is the test condition true for the if statement. plss explain...

Anonymous said...

simple and clear...

Unknown said...

thank u... its simple and clear

Anonymous said...

why we use system("pause")

Unknown said...

#include
void main()
{
int i,j;
printf("Your out put is here:\n");
for(i=5;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
}

Anonymous said...

#include
#include

void main(){
char str[5] = "Hello";
int len = strlen(str);
int i,j;
for(i=0;i<len;i++)
{
for(j=0;j<=i;j++)
{
printf("%c",str[j]);
}
printf("\n");
}
}

Dinesh said...

for (int i=5;i>0; i--) {
for (int j=1;j<i; j++) {
printf("%d",j);
}
printf("\n");
}

Mahendran said...

#include
main()
{
int i,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(i%3==0)
printf("%d %d ",i,i*3);
else
printf("%d ",i);
}
}

Anonymous said...

make a program that will display the word "Hello", "I'm Fine" and "Thank you" in different lines and column.

..please help me with this :)

Yoosuf said...

void main()
{
printf("%s","Hello\n");
printf("%15s","i am Fine\n");
printf("%25s","Thank You\n");
getch();
}

Unknown said...

#include
int main()
{

int i,j,n,p;
printf("enter the limit");
scanf("%d",&n);
p=n;
for(i=1;i<=p;i++)
{
for(j=1;j<=n;j++)
{
printf("%d",j);
}
printf("\n");
n=n-1;
}
}

Unknown said...

#include
#include
int main()
{
char g[55];
int n,i;
printf("enter the string");
gets(g);
n=strlen(g);
for(i=0;i<n;i++)
{
if(g[i]==' ')
printf("\n");
else
printf("%c",g[i]);
}
}

Unknown said...

#include
int main()
{
int i = 0;
int n = 0;
int count = 0;
int value = 0;

printf("\n Enter the range till you need to print : ");
scanf("%d",&n);

// printf("\n Enter the multiple value you need to print : ");
// scanf("%d",&value);

value = 9; //For the serious you need to print

for(i=1;i<=n;i++)
{
printf("%d ",i);
if(i%3==0)
{
count++;
printf("%d %d ", (count*value));
}
}
return 0;
}

shubham chopde said...

You Just Waste memory by Initializing int n & dosen't use it further in Program

Logo said...

printf() will just print the string when called, wherever it's placed, just that it prints the string then returns a 0 on success. using "if" or other stuff are just to avoid the usage of ;.

Unknown said...

because printf function always returns length of the string that is going to print, i.e. a non-zero integer, thats why if condition will be true in this case.

kabbir hossain said...

1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

Unknown said...

Why we can print any sentence without using semicolon?

Unknown said...

Write a function that takes a list of strings an prints them, one per line, in a rectangular frame
For example the list ["Hello", "World", "in", "a", "frame"] gets printed as:

*********
* Hello *
* World *
* in *
* a *
* frame *
*********

please could anybody solve this in C

Anonymous said...
This comment has been removed by a blog administrator.
Unknown said...

thnks

Unknown said...

can anyone please suggest me to write a program to print ,(comma) without using comma operator in whole program.

Unknown said...

Print the output as
1 99 2 98 3 ....