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
Can a local variable be volatile in c?
When we use void main and int main?
Where is volatile variable stored?
What is data structure in c programming?
#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }
What is the difference between constant pointer and constant variable?
What is uint8 in c?
What is far pointer in c?
write a c program to calculate sum of digits till it reduces to a single digit using recursion
What are the 32 keywords in c?
What is sizeof return in c?
How many levels deep can include files be nested?
Do you have any idea about the use of "auto" keyword?
What is the benefit of using const for declaring constants?
Why clrscr is used after variable declaration?