How can draw a box in cprogram without using graphics.h
header file & using only one printf(); ?
Answers were Sorted based on User's Feedback
Answer / chandan kumar r
#include<stdioh>
#include<conio.h>
void main()
{
printf("______________\n|______________|\n");
getch();
}
output:
____________________
|____________________|
| Is This Answer Correct ? | 37 Yes | 9 No |
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 |
Answer / veeramalliga
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("\n----------------\n");
printf("\n| |\n");
printf("\n| |\n");
printf("\n-----------------\n");
getch();
}
| Is This Answer Correct ? | 1 Yes | 8 No |
What is modeling?
write a program to swap two variables a=5 , b= 10 without using third variable
How do I read the arrow keys? What about function keys?
What is auto keyword in c?
What is the process of writing the null pointer?
writw a program to insert an element in the begning of a doubly linked list
Give me the code of in-order recursive and non-recursive.
What is stack in c?
what is the difference between 123 and 0123 in c?
main() { int i,n=010; int sum=0; for(i=1;i<=n;i++) {s=s+i; } printf("%d",&s); getch(); }
How do you use a 'Local Block'?
What is malloc and calloc?