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 |
Why do we use static in c?
what is the function of void main()?
What is the difference between void main() and int main()?
I have an array of 100 elements, each of which is a random integer. I want to know which of the elements: a) are multiples of 2 b) are multiples of 2 AND 5 c) have a remainder of 3 when divided by 7
1,4,8,13,21,30,36,45,54,63,73,?,?.
10 Answers AMB, Franklin Templeton,
in linking some of os executables are linking name some of them
IS Doon college of Engn.. has good faculty
Explain what is the heap?
write a program to remove occurrences the word from entered text?
what is the difference between <stdio.h> and "stdio.h"
14 Answers Invendis, Kanbay, Mastek, MathWorks,
What is call by value in c?
What is assignment operator?