LPU,NH-1 GT road, Jalandhar rohit.hero12@gmail.com +91-8437503569 https://www.facebook.com/rohit.adhikary3

P-Programming T-Technology A-And TI-Tips C-Cracking

Monday 20 April 2015

Diamond Pattern

Hello Reader,
This is the program of diamond pattern in which,when user will going to run the program that time there will be the shape of the diamond.
#include<iostream> //standard input/output
#include<conio.h>
using namespace std;
static int z=1; //define static variable
void pattern(int n) //using argument
{
static int i=0;
if(n>=0)   //if condition check
{
    for(int j=n;j>0;j--)  //for loop
{printf("%s",'');}
for(int k=0;k<((2*i)+1);k++) //for loop
{printf("%c",R);} //display
  printf("\n");
z++;
n--;
i++;
pattern(n); //n no of pattern
}
}

0 comments:

Post a Comment

Popular Posts

Recent Posts

Unordered List

Text Widget

Powered By Blogger
Powered by Blogger.

Contributors