Fill the screen with a smiling face

Write a program to fill the entire screen with a smiling face.
The smiling face has an ASCII value 1.

Other ideas..
An infinite loop like the following can also do the job.
for (i=1;i<=1000;)

#include<stdio.h>

main()
{
int i, j;

for (i=1, j=1; j<=5000; j++)

{
printf("%c", i);
}
}


Comments

friend said…
shall i know the logic that why u have used 5000
Nishant said…
That 5000 is just the approx number of smiley 2 avoid indefinite loop.
narendra said…
This comment has been removed by the author.
narendra said…
this following progam also displays smiling face very clearly try it once

#include
main()
{
int i;
for(i=0;i<=2559;i++)
{
printf("%c",2);
}
}
narendra said…
this following progam also displays smiling face very clearly try it once

#include
main()
{
int i;
for(i=0;i<=2559;i++)
{
printf("%c",2);
}
}
Anonymous said…
plz tell how int is converted to char and why 2 is used?
akshay said…
u cn use any int instead of 2 dats jst for wat u wanna print on screen.n char is nt used becoz u hve only integars hve dis smilin faces ascii..char has 66 77 like ascii value
Unknown said…
i tried all your prpgram .when i compiled my program there was no error and when i moved to the output in the terminal the smiling faces doesnt appear but instead it leaves some space
sir can we write like this......
#include
#include
void main ()
{
int i,j;
for(i=1;i<=5000;i++)
{
for(j=1;j<=i;j++)
printf("\n 1" );
}
getch();
}
sir can we write like this......
#include
#include
void main ()
{
int i,j;
for(i=1;i<=5000;i++)
{
for(j=1;j<=i;j++)
printf("\n 1" );
}
getch();
}
Deepak Dhingan said…
Why we use 1 in the printf function
Anonymous said…
2 is an ASCII value.Search for ASCII value on Internet.Then you will understand
Unknown said…
U all just use getch() in the first program and u all will see the whole screen with smiling face

Popular posts from this blog

C Program - Calculation of Area and Circumference of a Circle using Pointers

Matchstick Game using C Programming

C Program to Calculate Factorial of a number using Recursion