how to insert a rectange box in c programming?
Answers
Answered by
1
║#include<graphics.h>║#include<conio.h>║main()║{║int gd=DETECT,gm;║initgraph(&gd,&gm,"C:\\TC\\BGI");║rectangle(100,100,200,200);║getch();║closegraph();║return 0;║}
Yasmin:
This is how to insert a rectangle in c programming
Answered by
0
#include <stdio.h>
main (void)
{
int width, height, i, j;
printf("Enter the width of the rectangle.\n");
scanf("%d", &width);
printf("Enter the height of the rectangle.\n");
scanf("%d", &height);
for(i = 0; i < width; i++)
{
printf("*");
}
printf("\n");
for(i = 0; i < (height-2); i++)
{
printf("*");
for(j = 0; j < (width-2); j++)
{
printf(" ");
}
printf("*");
printf("\n");
}
for(i = 0; i < width; i++)
{
printf("*");
}
printf("\n");
system("PAUSE");
return 0;
}
main (void)
{
int width, height, i, j;
printf("Enter the width of the rectangle.\n");
scanf("%d", &width);
printf("Enter the height of the rectangle.\n");
scanf("%d", &height);
for(i = 0; i < width; i++)
{
printf("*");
}
printf("\n");
for(i = 0; i < (height-2); i++)
{
printf("*");
for(j = 0; j < (width-2); j++)
{
printf(" ");
}
printf("*");
printf("\n");
}
for(i = 0; i < width; i++)
{
printf("*");
}
printf("\n");
system("PAUSE");
return 0;
}
Similar questions