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 Lazy evaluation in C? Give an example.
Which is more efficient, a switch statement or an if else chain?
what is the flow of execution in cprogram? ex:printf();,scanf();
What is scope of variable in c?
write a program that finds the factorial of a number using recursion?
what is link list?
What does the error message "DGROUP exceeds 64K" mean?
write a c program to add two integer numbers without using arithmetic operator +
Is calloc better than malloc?
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...
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