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

While(1) { } when this loop get terminate is it a infinite loop?

5 Answers  


what are the advantage of pointer variables? write a program to count the number of vowels and consonants in a given string

3 Answers  


Is fortran still used in 2018?

0 Answers  


What is the difference between mpi and openmp?

0 Answers  


What are the 4 types of programming language?

0 Answers  






What are static variables in c?

0 Answers  


What does int main () mean?

0 Answers  


main() { float a=3.2e40; printf("%d",a); }

9 Answers   Satyam,


Define function pointers?

1 Answers  


What are the types of pointers in c?

0 Answers  


Is main() is used in the program,,see below example? void main() { int i; for(i=0;i<10;i++) main(); } Then what is the output of the program?

6 Answers  


Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it?

3 Answers  


Categories