gdata.io.handleScriptLoaded({"version":"1.0","encoding":"UTF-8","feed":{"xmlns":"http://www.w3.org/2005/Atom","xmlns$openSearch":"http://a9.com/-/spec/opensearchrss/1.0/","xmlns$gd":"http://schemas.google.com/g/2005","xmlns$georss":"http://www.georss.org/georss","xmlns$thr":"http://purl.org/syndication/thread/1.0","xmlns$blogger":"http://schemas.google.com/blogger/2008","id":{"$t":"tag:blogger.com,1999:blog-5735018943946871385"},"updated":{"$t":"2023-12-09T13:35:10.032-08:00"},"category":[{"term":"Hackerrank Delete duplicate-value nodes from a sorted linked list Solution"},{"term":"Hackerrank Print the elements of a linked list solution"},{"term":"PATTERNS"},{"term":"pattern generation in c"},{"term":"c++ program"},{"term":"Hackerrank Reverse a doubly linked list solution"},{"term":"programming"},{"term":"TEXT ANALYZER"},{"term":"networks"},{"term":"triangle pattern c++"},{"term":"unipolar encoding simulation"},{"term":"Hackerrank Print in Reverse solution"},{"term":"c++"},{"term":"education"},{"term":"opps sandclock pattern"},{"term":"opps triangle pattern"},{"term":"Linked Lists in C++"},{"term":"coding"},{"term":"C++ Diamond Pattern"},{"term":"hourglass pattern c++"},{"term":"hackerrank"},{"term":"java"},{"term":"c"},{"term":"Utopian tree"},{"term":"lexical analyser"},{"term":"cpp"},{"term":"Hackerrank Insert a node into a sorted doubly linked list Solution"},{"term":"java program"},{"term":"mini project"},{"term":"c programming"},{"term":"operator precedence"}],"title":{"type":"text","$t":"GRK"},"subtitle":{"type":"html","$t":"A blog by Gokul Raj Kumar"},"link":[{"rel":"http://schemas.google.com/g/2005#feed","type":"application/atom+xml","href":"https://blog.grkweb.com/feeds/posts/default/-/PATTERNS?alt\u003djson-in-script\u0026max-results\u003d6"},{"rel":"self","type":"application/atom+xml","href":"https://blog.grkweb.com/feeds/posts/default/-/PATTERNS?alt\u003djson-in-script\u0026max-results\u003d6"},{"rel":"alternate","type":"text/html","href":"http://blog.grkweb.com/search/label/PATTERNS"},{"rel":"hub","href":"http://pubsubhubbub.appspot.com/"}],"author":[{"name":{"$t":"GRK"},"uri":{"$t":"https://draft.blogger.com/profile/00099219911209322075"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"35","height":"35","src":"//www.blogger.com/img/blogger_logo_round_35.png"}}],"generator":{"version":"7.00","uri":"https://draft.blogger.com","$t":"Blogger"},"openSearch$totalResults":{"$t":"2"},"openSearch$startIndex":{"$t":"1"},"openSearch$itemsPerPage":{"$t":"6"},"entry":[{"id":{"$t":"tag:blogger.com,1999:blog-5735018943946871385.post-787642138016423133"},"published":{"$t":"2015-08-05T09:10:00.000-07:00"},"updated":{"$t":"2015-08-05T09:10:36.513-07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"cpp"},{"scheme":"http://www.blogger.com/atom/ns#","term":"c++"},{"scheme":"http://www.blogger.com/atom/ns#","term":"C++ Diamond Pattern"},{"scheme":"http://www.blogger.com/atom/ns#","term":"PATTERNS"},{"scheme":"http://www.blogger.com/atom/ns#","term":"pattern generation in c"}],"title":{"type":"text","$t":"C++ Diamond Pattern "},"content":{"type":"html","$t":"\u003cdiv dir\u003d\"ltr\" style\u003d\"text-align: left;\" trbidi\u003d\"on\"\u003e\nC++ program to print the diamond pattern using '#' symbols. In this program two for loops are used to print the pattern. The first loop prints the upper part to the diamond ( triangle part ). The second for loop prints the lower part of the diamond (an inverted triangle ) . By combining both of the triangles an diamond pattern structure is formed.\u003cbr /\u003e\n\u003ch2 style\u003d\"text-align: left;\"\u003e\nPROGRAM CODE:\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cpre style\u003d\"background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;\"\u003e\u003ccode style\u003d\"color: black; word-wrap: normal;\"\u003e #include\u0026lt;iostream\u0026gt;  \n using namespace std;  \n  int main()  \n  {  \n    int i,j,k\u003d1,s\u003d6,l;  \n    for(i\u003d0;i\u0026lt;5;i++,k-\u003d2,s-\u003d1)  \n    {  \n      for(l\u003ds-1;l\u0026gt;\u003d0;l--)  \n      cout\u0026lt;\u0026lt;' ';  \n      for(j\u003dk;j\u0026lt;0;j++)  \n        cout\u0026lt;\u0026lt;\"#\";  \n      cout\u0026lt;\u0026lt;endl;  \n   }  \n k \u003d 9;  \n s \u003d 0;  \n for(i\u003d0;i\u0026lt;5;i++,k-\u003d2,s+\u003d1)  \n    {  \n      for(l\u003ds;l\u0026gt;\u003d0;l--)  \n      cout\u0026lt;\u0026lt;' ';  \n      for(j\u003dk;j\u0026gt;0;j--)  \n         cout\u0026lt;\u0026lt;\"#\";  \n      cout\u0026lt;\u0026lt;endl;  \n    }  \n  return 0;  \n  }  \n\u003c/code\u003e\u003c/pre\u003e\n\u003c/div\u003e\n\u003ch2 style\u003d\"text-align: left;\"\u003e\nOUTPUT:\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cspan style\u003d\"background-color: white; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;#\u003c/span\u003e\u003cbr style\u003d\"background-color: white; box-sizing: border-box; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\" /\u003e\u003cspan style\u003d\"background-color: white; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; # # #\u003c/span\u003e\u003cbr style\u003d\"background-color: white; box-sizing: border-box; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\" /\u003e\u003cspan style\u003d\"background-color: white; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp;# # # # #\u003c/span\u003e\u003cbr style\u003d\"background-color: white; box-sizing: border-box; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\" /\u003e\u003cspan style\u003d\"background-color: white; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\"\u003e\u0026nbsp; \u0026nbsp;# # # # # # #\u003c/span\u003e\u003cbr style\u003d\"background-color: white; box-sizing: border-box; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\" /\u003e\u003cspan style\u003d\"background-color: white; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\"\u003e# # # # # # # # #\u003c/span\u003e\u003c/div\u003e\n\u003cdiv\u003e\n\u003cspan style\u003d\"background-color: white; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\"\u003e\u0026nbsp; \u0026nbsp;# # # # # # #\u003c/span\u003e\u003cbr style\u003d\"background-color: white; box-sizing: border-box; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\" /\u003e\u003cspan style\u003d\"background-color: white; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; # # # # #\u003c/span\u003e\u003cbr style\u003d\"background-color: white; box-sizing: border-box; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\" /\u003e\u003cspan style\u003d\"background-color: white; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; # # #\u003c/span\u003e\u003c/div\u003e\n\u003cdiv\u003e\n\u003cspan style\u003d\"background-color: white; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; #\u0026nbsp;\u003c/span\u003e\u003c/div\u003e\n\u003cdiv\u003e\n\u003cspan style\u003d\"background-color: white; color: #404040; font-family: 'Roboto Slab', sans-serif; font-size: 15px; line-height: 30px;\"\u003e\u003cbr /\u003e\u003c/span\u003e\u003c/div\u003e\n\u003cdiv\u003e\n\u003cspan style\u003d\"background-color: white; font-size: 15px; line-height: 30px;\"\u003e\u003cspan style\u003d\"color: #404040; font-family: Roboto Slab, sans-serif;\"\u003e** The above solution is my own code and it may not be the optimal solution or optimal way to approach the problem. So if you have any optimal approaches feel free to paste the code as the comment below..... :) :) :)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\n\u003c/div\u003e\n"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https://blog.grkweb.com/feeds/787642138016423133/comments/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https://blog.grkweb.com/2015/08/c-diamond-pattern.html#comment-form","title":"0 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https://draft.blogger.com/feeds/5735018943946871385/posts/default/787642138016423133"},{"rel":"self","type":"application/atom+xml","href":"https://blog.grkweb.com/feeds/posts/default/787642138016423133"},{"rel":"alternate","type":"text/html","href":"https://blog.grkweb.com/2015/08/c-diamond-pattern.html","title":"C++ Diamond Pattern "}],"author":[{"name":{"$t":"GRK"},"uri":{"$t":"https://draft.blogger.com/profile/00099219911209322075"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"35","height":"35","src":"//www.blogger.com/img/blogger_logo_round_35.png"}}],"thr$total":{"$t":"0"}},{"id":{"$t":"tag:blogger.com,1999:blog-5735018943946871385.post-1996132387832272895"},"published":{"$t":"2014-04-30T09:02:00.002-07:00"},"updated":{"$t":"2022-01-16T09:53:27.530-08:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"cpp"},{"scheme":"http://www.blogger.com/atom/ns#","term":"opps triangle pattern"},{"scheme":"http://www.blogger.com/atom/ns#","term":"PATTERNS"},{"scheme":"http://www.blogger.com/atom/ns#","term":"triangle pattern c++"}],"title":{"type":"text","$t":"C++ Triangle pattern"},"content":{"type":"html","$t":"\u003cdiv dir\u003d\"ltr\" style\u003d\"text-align: left;\" trbidi\u003d\"on\"\u003e\n\u003ch2 style\u003d\"text-align: left;\"\u003e\nPROGRAM CODE :\u003c/h2\u003e\n\u003cpre style\u003d\"background-color: #f0f0f0; background-position: initial initial; background-repeat: initial initial; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;\"\u003e\u003ccode style\u003d\"color: black; word-wrap: normal;\"\u003e #include\u0026lt;iostream.h\u0026gt;  \n #include\u0026lt;conio.h\u0026gt;  \n void main()  \n {  \n          char a[]\u003d\"program\";  \n          int i,j;  \n          clrscr();  \n          for(i\u003d0;i\u0026lt;7;i++)  \n          {  \n                   for(j\u003d0;j\u0026lt;\u003di;j++)  \n                   {  \n                           cout\u0026lt;\u0026lt;a[j]\u0026lt;\u0026lt;'\\t';  \n                   }  \n                   cout\u0026lt;\u0026lt;endl;  \n           }  \n           getch();  \n }  \n\u003c/code\u003e\u003c/pre\u003e\n\u003cdiv style\u003d\"text-align: center;\"\u003e\n\u003cbr /\u003e\n\u003c/div\u003e\n\u003ch2 style\u003d\"text-align: left;\"\u003e\nOUTPUT :\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u0026nbsp; \u0026nbsp;p\u003c/div\u003e\n\u003cdiv\u003e\n\u0026nbsp; \u0026nbsp;p \u0026nbsp; \u0026nbsp;r\u0026nbsp;\u003c/div\u003e\n\u003cdiv\u003e\n\u0026nbsp; \u0026nbsp;p \u0026nbsp; \u0026nbsp;r \u0026nbsp; \u0026nbsp;o\u0026nbsp;\u003c/div\u003e\n\u003cdiv\u003e\n\u0026nbsp; \u0026nbsp;p \u0026nbsp; \u0026nbsp;r \u0026nbsp; \u0026nbsp;o \u0026nbsp; \u0026nbsp;g\u0026nbsp;\u003c/div\u003e\n\u003cdiv\u003e\n\u0026nbsp; \u0026nbsp;p \u0026nbsp; \u0026nbsp;r \u0026nbsp; \u0026nbsp;o \u0026nbsp; \u0026nbsp;g \u0026nbsp; \u0026nbsp;r\u0026nbsp;\u003c/div\u003e\n\u003cdiv\u003e\n\u0026nbsp; \u0026nbsp;p \u0026nbsp; \u0026nbsp;r \u0026nbsp; \u0026nbsp;o \u0026nbsp; \u0026nbsp;g \u0026nbsp; \u0026nbsp;r \u0026nbsp; \u0026nbsp;a\u003c/div\u003e\n\u003cdiv\u003e\n\u0026nbsp; \u0026nbsp;p \u0026nbsp; \u0026nbsp;r \u0026nbsp; \u0026nbsp;o \u0026nbsp; \u0026nbsp;g \u0026nbsp; \u0026nbsp;r \u0026nbsp; \u0026nbsp;a \u0026nbsp; \u0026nbsp;m\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https://blog.grkweb.com/feeds/1996132387832272895/comments/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https://blog.grkweb.com/2014/04/c-triangle-pattern.html#comment-form","title":"0 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https://draft.blogger.com/feeds/5735018943946871385/posts/default/1996132387832272895"},{"rel":"self","type":"application/atom+xml","href":"https://blog.grkweb.com/feeds/posts/default/1996132387832272895"},{"rel":"alternate","type":"text/html","href":"https://blog.grkweb.com/2014/04/c-triangle-pattern.html","title":"C++ Triangle pattern"}],"author":[{"name":{"$t":"GRK"},"uri":{"$t":"https://draft.blogger.com/profile/00099219911209322075"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"35","height":"35","src":"//www.blogger.com/img/blogger_logo_round_35.png"}}],"thr$total":{"$t":"0"}}]}});