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
Explain the difference between malloc() and calloc() function?
What is pointers in c?
Where can I get an ansi-compatible lint?
What is identifier in c?
What are the benefits of organizational structure?
What is the scope of local variable in c?
How to write a code for reverse of string without using string functions?
What are the types of macro formats?
Can we compile a program without main() function?
a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.
What is the significance of an algorithm to C programming?
What is a pragma?
How do you define structure?
using only #include
What is the difference between union and anonymous union?