VOOZH about

URL: https://www.geeksforgeeks.org/c/c-program-to-draw-the-taj-mahal-using-graphics/

⇱ C program to draw the Taj Mahal using graphics - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C program to draw the Taj Mahal using graphics

Last Updated : 23 Jul, 2025

In Turbo C graphics the graphics.h functions are used to draw different shapes(like a circle, rectangle, etc), display text(any message) in different formats (different fonts and colors). By using graphics.h programs, animations, and also games can be designed. These can be useful for beginners.

Function Used:

  • arc(x, y, start_ang, end_ang, r): A function from graphics.h header file which draws an arc with (x, y) as the center, start_ang is its starting angle, end_ang is its ending angle, and r as radius.
  • rectangle(l, t, r, b): A function from graphics.h header file which draw a rectangle from left(l) to right(r) and from top(t) to bottom(b).
  • line(a1, b1, a2, b2): A function from graphics.h header file which draws a line from (a1, b1) point to (a2, b2) point.


Approach:

  • Here three functions taj_body(), left_minars(), and right_minars() are defined.
  • In the main() function, the first taj_body() function is called. In this function, the building of the Taj Mahal was started created from a Rectangle Base using the rectangle() function.
  • Then two Rectangles are made using the rectangle() function. In Smaller Rectangle a Door is made by using the line() function.
  • Then the Onion Dome is made by using the arc() function. On that Dome, a finial is created by using line() functions.
  • On both sides of that Dome, two smaller Domes are created by using the arc() function, and also a Finial is drawn by using the line() function.
  • Then other Decorations have been implemented by mostly using the line() function and rectangle() function in a few cases. These decorations have to implement on both sides of the Taj Mahal.
  • After completion of taj_body() function the left_minars() function is called to implement Left Side Minarets. These two Minarets are completely made by using the line() function and by calculation.
  • Then right_minars() function is called to implement Right Side Minarets. These two Minarets are also completely made by using the line() function and by calculation.


Output:

👁 Output
TAJ MAHAL
Comment