Write code to Print below simple design. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write code to Print below simple design.

* * * * * * * * *

24th May 2018, 4:45 AM
Pramod Chougule
Pramod Chougule - avatar
2 Answers
+ 3
Could you link your trial code here? Also, you could look up this page: " Program to print the diamond shape" https://www.google.co.in/amp/s/www.geeksforgeeks.org/c-program-print-diamond-shape/amp/
24th May 2018, 5:23 AM
Rahul George
Rahul George - avatar
+ 1
var a = 5; //number of lines to print var b; var s=(a/2)+1; for(b=1;b<=(a/2)+1;b++) { for(c=1;c<=s;c++){ document .write ("&nbsp"); } s--; for(d=1;d<=b;d++){ document .write(" *"); } document .write ("<br />"); } //after half s=(a/2); for(b=(a/2);b>1;b--){ for(c=1;c<s;c++){ document .write ("&nbsp"); } s++; for(d=1;d<b;d++){ document .write (" *"); } document .write ("<br />"); }
25th May 2018, 1:02 AM
Pramod Chougule
Pramod Chougule - avatar