how can u draw a rectangle in C
Answers were Sorted based on User's Feedback
Answer / sunny khanna
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int driver,mode;
driver=DETECT;
initgraph(&driver,&mode,"c:\\tc\\bgi");
rectangle(100,100,250,250);
getche();
closegraph();
}
Is This Answer Correct ? | 46 Yes | 11 No |
Answer / venkatesh
line(x1,y1,x2,y1)
line(x1,y2,x2,y2)
line(x1,y1,x1,y2)
line(x2,y1,x2,y2)
Is This Answer Correct ? | 51 Yes | 17 No |
Answer / srinivas.m
#include<graphics.h>
#include<conio.h>
void main()
{
int gd=DETECT, gm;
initgraph(&gd, &gm, "c:\\turboc3\\bgi " );
rectangle(200,50,350,150);
getch();
closegraph();
}
Is This Answer Correct ? | 24 Yes | 4 No |
Answer / shrikant
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n;
clrscr();
printf("Enter the value of n\n");
scanf("%d",&n);
for(i=0;i<=n;i++)
{
for(j=0;j<=2*n;j++)
{
if((i>0 && i<n) && (j>0 && j<2*n))
{
printf(" ");
}
else
{
printf("* ");
}
}
printf("\n");
}
getch();
}
Is This Answer Correct ? | 23 Yes | 4 No |
Answer / prabhanjan
#include
#include
#include
main()
{
int gd=DETECT, gm,x,y;
int arr[]={540,220,590,270,570,320,510,320,490,270,540,220};
initgraph(&gd,&gm,"c:\\tc\\bgi");
x=getmaxx();
y=getmaxy();
setcolor(GREEN);
printf(" \n value of x = %d",x);
printf(" and the value of y = %d",y);
rectangle(5,40,140,200);
outtextxy(x/30+15,y/8+5,"Rectangle");
drawpoly(6,arr);
outtextxy(515,270,"Polygon");
setcolor(RED);
line(0,49,639,479);
line(0,0,0,479);
line(0,0,639,0);
line(639,0,639,479);
getch();
closegraph();
restorecrtmode();
}
Is This Answer Correct ? | 21 Yes | 13 No |
Answer / sabarinathan
void main()
{
int n=0,i=0;
printf("how many lines should rectangle can occupied");
scanf("%d",n);
printf("____________");
prinf("/n");
for(i=0;i<=n;i++)
{
printf("| |");
printf("/n");
}
printf("____________")
}
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / joker
why do you want to draw rectangle using C if you can do it
in a paper its more simpler and faster, no developer
required hence cost effective.
Is This Answer Correct ? | 9 Yes | 5 No |
Answer / vignesh
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
int main()
{
int driver,mode;
detectgraph(&driver,&mode);
initgraph(&driver,&mode,"...\\bgi");
setcolor(8);
for(i=10;i<201;i++)
{
sound(i);
rectangle(200,50,350,150);
delay(1000);
nosound();
}
getch();
}
Is This Answer Correct ? | 7 Yes | 4 No |
Find the largest number in a binary tree
main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?
What is your nationality?
main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }
What is full form of PEPSI
how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.
0 Answers Mbarara University of Science and Technology,
How can I Create a C program in splitting set of characters to specific subsets. Example: INPUT SET OF CHARACTERS: Therefore, my dear brothers and sisters, stand firm. Let nothing move you. Always give yourselves fully to the work of the Lord, because you know that your labor in the Lord is not in vain. SPLIT INTO HOW MANY CHARACTERS PER SUBSETS: 10 OUTPUT: Therefore, my dear b rothers an d sisters, stand fir m. Let not hing move you. Alway s give you rselves fu lly to the work of t he Lord, b ecause you know that your labo r in the L ord is not in vain.
main() { int (*functable[2])(char *format, ...) ={printf, scanf}; int i = 100; (*functable[0])("%d", i); (*functable[1])("%d", i); (*functable[1])("%d", i); (*functable[0])("%d", &i); } a. 100, Runtime error. b. 100, Random number, Random number, Random number. c. Compile error d. 100, Random number
Write a function to find the depth of a binary tree.
13 Answers Adobe, Amazon, EFI, Imagination Technologies,
can u give me the c codings for converting a string into the hexa decimal form......
char inputString[100] = {0}; To get string input from the keyboard which one of the following is better? 1) gets(inputString) 2) fgets(inputString, sizeof(inputString), fp)
respected sir, i did my MCA in 2013 when i am going to attend to an interview i was asked about my project how will i explain my project could please help me in this and my project title is "Social Networking Site For Social Responsibility"