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



How can draw a box in cprogram without using graphics.h header file & using only one printf();..

Answer / chandan kumar r

#include<stdioh>
#include<conio.h>
void main()
{
printf("______________\n|______________|\n");
getch();
}

output:
____________________
|____________________|

Is This Answer Correct ?    37 Yes 9 No

How can draw a box in cprogram without using graphics.h header file & using only one printf();..

Answer / 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

How can draw a box in cprogram without using graphics.h header file & using only one printf();..

Answer / jai

this is foolish question

Is This Answer Correct ?    0 Yes 2 No

How can draw a box in cprogram without using graphics.h header file & using only one printf();..

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

Post New Answer

More C Interview Questions

What is Lazy evaluation in C? Give an example.

1 Answers  


Which is more efficient, a switch statement or an if else chain?

0 Answers  


what is the flow of execution in cprogram? ex:printf();,scanf();

2 Answers  


What is scope of variable in c?

0 Answers  


write a program that finds the factorial of a number using recursion?

13 Answers   Infosys, TATA,






what is link list?

3 Answers  


What does the error message "DGROUP exceeds 64K" mean?

0 Answers   Celstream,


write a c program to add two integer numbers without using arithmetic operator +

13 Answers   Value Labs,


Is calloc better than malloc?

0 Answers  


How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

2 Answers   Aricent, Manipal University,


how to execute a program using if else condition and the output should enter number and the number is odd only...

0 Answers  


Function shall sum members of given one-dimensional array. However, it should sum only members whose number of ones in the binary representation is higher than defined threshold (e.g. if the threshold is 4, number 255 will be counted and 15 will not) - The array length is arbitrary - output the results to the stdout

0 Answers   XYZ,


Categories