EmSAT Achieve Exam  >  EmSAT Achieve Notes  >  C++ for EmSAT Achieve  >  Code: Full Triangle/Pyramid Pattern

Code: Full Triangle/Pyramid Pattern | C++ for EmSAT Achieve PDF Download

Code: Full Triangle/Pyramid Pattern | C++ for EmSAT Achieve

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 | C++ for EmSAT Achieve is a part of the EmSAT Achieve Course C++ for EmSAT Achieve.
All you need of EmSAT Achieve at this link: EmSAT Achieve
70 videos|45 docs|15 tests

Top Courses for EmSAT Achieve

70 videos|45 docs|15 tests
Download as PDF
Explore Courses for EmSAT Achieve exam

Top Courses for EmSAT Achieve

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
Related Searches

mock tests for examination

,

past year papers

,

Previous Year Questions with Solutions

,

shortcuts and tricks

,

Extra Questions

,

Sample Paper

,

ppt

,

Important questions

,

Code: Full Triangle/Pyramid Pattern | C++ for EmSAT Achieve

,

Free

,

MCQs

,

Code: Full Triangle/Pyramid Pattern | C++ for EmSAT Achieve

,

Code: Full Triangle/Pyramid Pattern | C++ for EmSAT Achieve

,

Summary

,

Semester Notes

,

study material

,

pdf

,

Exam

,

video lectures

,

Viva Questions

,

practice quizzes

,

Objective type Questions

;