coding for printing diamond pattern using recursion
as following
*
* *
* * *
* * * *
* * *
* *
*

Recommended Answers

All 3 Replies

Please show us some work, ask questions.

Then you'll get some help.

#include <iostream>
using namespace std;
int main(){

int i, j, N=7;

for(i=1; i<=(0.5*N+1); i++){
    for(j=1;j<=i; j++){
        cout<<"*";}
cout<<"\n";}

for(i=(0.5*N); i<=N; i++){
for(j=(N-1); j>i; j--){
    cout<<"*";}
cout<<"\n";}



return 0;}

hope this gives you an idea that you can manipulate to your taste

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.