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 |
While(1) { } when this loop get terminate is it a infinite loop?
what are the advantage of pointer variables? write a program to count the number of vowels and consonants in a given string
Is fortran still used in 2018?
What is the difference between mpi and openmp?
What are the 4 types of programming language?
What are static variables in c?
What does int main () mean?
main() { float a=3.2e40; printf("%d",a); }
Define function pointers?
What are the types of pointers in c?
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?
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?