C Program to Display a Rectangle or Square box for the given values


SOURCE CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
int x,y,l,h,n;
clrscr();
printf("Enter the values of x-axis,y-axis,length,height:");

scanf("%d%d%d%d",&x,&y,&l,&h);
gotoxy(x,y);
printf("%c",218);
gotoxy(x+l,y);
printf("%c",191);
gotoxy(x,y+h);
printf("%c",192);
gotoxy(x+l,y+h);
printf("%c",217);
for(n=1;n<l;n++)
{
gotoxy(x+n,y);
printf("%c",196);
gotoxy(x+n,y+h);
printf("%c",196);
}
for(n=1;n<h;n++)
{
gotoxy(x,y+n);
printf("%c",179);
gotoxy(x+l,y+n);
printf("%c",179);
}
gotoxy(39,12);
getch();
}
Previous
Next Post »

Still not found what you are looking for? Try again here.