1 / 3

PREPARE A STAIRCASE BY USING THE RECTANGLE DRAWN IN SEQUENCE

Start. int driver,mode. int x=100,y=150,i. for (i=1;i<=6;i++). PREPARE A STAIRCASE BY USING THE RECTANGLE DRAWN IN SEQUENCE. bar(x,y,x+100,y+150). x=x+50 y=y+50. Output. stop. Start program. Define data type. EXPLAINATION.

ziya
Download Presentation

PREPARE A STAIRCASE BY USING THE RECTANGLE DRAWN IN SEQUENCE

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Start int driver,mode int x=100,y=150,i for (i=1;i<=6;i++) PREPARE A STAIRCASE BY USING THE RECTANGLE DRAWN IN SEQUENCE bar(x,y,x+100,y+150) x=x+50 y=y+50 Output stop

  2. Start program Define data type EXPLAINATION x and y= horizontal and vertical coordinates, Initialize the value of x and y, i= variable used to count no. of staircase i varies from 1 to 6 and In each step i varies by one Draw a filled rectangle on given position Increment in x and y by50 Display a staircase End of program

  3. Program: /*program to draw a staircase by using the rectangle in sequence*/ #include<conio.h> /*header file included*/ #include<graphics.h> /*graphics header file included*/ void main() /*execution of program starts here*/ { /*starting braces*/ int driver,mode,x,y,i; /*data type defined that must be integer type varible*/ detectgraph(&driver,&mode); /*driver and modes are set*/ initgraph(&driver,&mode,"\\BGI"); /*graphic mode is initialized*/ setpalette(0,5); x=100;y=150; /*value of x and y are assigned*/ for(i=1;i<=6;++i) /*for loop is used to draw rectangle in sequence*/ { /*starting braces of for loop*/ bar(x,y,x+100,y+150); /*bar coordinates are defined*/ x=x+50;y=y+50; } /*ending braces of for loop*/ getch(); /*display o/p on screen*/ restorecrtmode(); /*restore the screen to the mode */ } /*ending braces*/

More Related