Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions C/pyramid in c ++.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include<iostream>
using namespace std;
int main()
{
int i, space, rowSize, k=0;
cout<<"Enter the Number of Rows: ";
cin>>rowSize;
cout<<"\nPyramid of "<<rowSize<<" Rows or Lines:\n";
for(i=1; i<=rowSize; i++)
{
for(space=1; space<=(rowSize-i); space++)
cout<<" ";
while(k!=(2*i-1))
{
cout<<"* ";
k++;
}
k=0;
cout<<endl;
}
cout<<endl;
return 0;
}
1 change: 1 addition & 0 deletions Python/pyramid in python.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[{"file_id":"1tPR3Sk9QGwlz_wQbidmFQExlUt_dMQjC","timestamp":1665548998733}],"collapsed_sections":[],"authorship_tag":"ABX9TyP+lNo9nBfWQqm6ERJRNpkg"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"2Xbeagmsa_7N","executionInfo":{"status":"ok","timestamp":1665548965475,"user_tz":-330,"elapsed":3354,"user":{"displayName":"Deepanshu Khandelwal","userId":"08509642947675263646"}},"outputId":"5c011128-f4bf-4185-edc6-dfd35af1874a"},"outputs":[{"output_type":"stream","name":"stdout","text":["Enter number of rows: 9\n"," * \n"," * * * \n"," * * * * * \n"," * * * * * * * \n"," * * * * * * * * * \n"," * * * * * * * * * * * \n"," * * * * * * * * * * * * * \n"," * * * * * * * * * * * * * * * \n","* * * * * * * * * * * * * * * * * \n"]}],"source":["rows = int(input(\"Enter number of rows: \"))\n","\n","k = 0\n","\n","for i in range(1, rows+1):\n"," for space in range(1, (rows-i)+1):\n"," print(end=\" \")\n"," \n"," while k!=(2*i-1):\n"," print(\"* \", end=\"\")\n"," k += 1\n"," \n"," k = 0\n"," print()"]}]}