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
}
}
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