Software Development Exam  >  Software Development Notes  >  Basics of C++  >  Code: Full Triangle/Pyramid Pattern

Code: Full Triangle/Pyramid Pattern | Basics of C++ - Software Development PDF Download

Code: Full Triangle/Pyramid Pattern | Basics of C++ - Software Development

C++ Program for Full Triangle/Full Pyramid

#include<iostream>


using namespace std;


void PyramidPattern1(int n) {

  for (int i = 1; i <= n; i++) {

    for (int k = n - i; k > 0; k--) {

      cout << " ";

    }

    for (int j = 1; j <= i; j++) {

      cout << "* ";

    }

    cout << endl;

  }

}

void PyramidPattern2(int n) {

  for (int i = n; i >= 1; i--) {

    for (int k = n - i; k > 0; k--) {

      cout << " ";

    }

    for (int j = i; j > 0; j--) {

      cout << "* ";

    }

    cout << endl;

  }

}


int main() {

  int num;

  cout << "Enter number of levels of the pattern :" << endl;

  cin >> num;

  PyramidPattern1(num);

  cout << endl;

  PyramidPattern2(num);


  return 0;

}

The document Code: Full Triangle/Pyramid Pattern | Basics of C++ - Software Development is a part of the Software Development Course Basics of C++.
All you need of Software Development at this link: Software Development
70 videos|45 docs|15 tests

Up next

70 videos|45 docs|15 tests
Download as PDF

Up next

Explore Courses for Software Development exam
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Download the FREE EduRev App
Track your progress, build streaks, highlight & save important lessons and more!
Related Searches

shortcuts and tricks

,

Sample Paper

,

mock tests for examination

,

MCQs

,

Extra Questions

,

Viva Questions

,

Code: Full Triangle/Pyramid Pattern | Basics of C++ - Software Development

,

Exam

,

practice quizzes

,

Summary

,

Free

,

video lectures

,

Code: Full Triangle/Pyramid Pattern | Basics of C++ - Software Development

,

pdf

,

past year papers

,

study material

,

Semester Notes

,

Previous Year Questions with Solutions

,

Important questions

,

Code: Full Triangle/Pyramid Pattern | Basics of C++ - Software Development

,

Objective type Questions

,

ppt

;