How can draw a box in cprogram without using graphics.h
header file & using only one printf(); ?
Answer Posted / c.p.senthil
Generic Box routine,
to draw with prescribed length and width
// function defintion
void drawBox(int length, int width)
{
int i, j;
for(i=0; i<length; i++)
printf("_");
printf("\n");
for(j=0; j<width-1; j++)
{
printf("|");
for(i=0; i<(length-2); i++)
printf(" ");
printf("|");
printf("\n");
}
printf("|");
for(i=0; i<length-2; i++)
printf("_");
printf("|");
}
// function call
drawBox(30, 5);
Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is getch() function?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
When c language was developed?
What is c standard library?
What does a function declared as pascal do differently?
Explain what is a stream?
Tell me can the size of an array be declared at runtime?
What are type modifiers in c?
What is a null string in c?
In c programming language, how many parameters can be passed to a function ?
Why we write conio h in c?
Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?
Explain Basic concepts of C language?
The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?
What is bss in c?