diff --git a/Profiles/vanshika b/Profiles/vanshika new file mode 100644 index 00000000..44fe19e7 --- /dev/null +++ b/Profiles/vanshika @@ -0,0 +1,115 @@ +IMPORTANT PATTERN PROBLEMS IN CPP +#include +using namespace std; +int main() +{ + int rows; +cout << "Enter number of rows: "; + cin >> rows; +for(int i = rows; i >= 1; --i) + { + for(int j = 1; j <= i; ++j) + { + cout << j << " "; + } + cout << endl; + } +return 0; +} +OUTPUT : +1 2 3 4 5 +1 2 3 4 +1 2 3 +1 2 +1 +#include +using namespace std; +int main() +{ + int rows; +cout << "Enter number of rows: "; + cin >> rows; +for(int i = 1; i <= rows; ++i) + { + for(int j = 1; j <= i; ++j) + { + cout << j << " "; + } + cout << "\n"; + } + return 0; +} +OUTPUT : +1 +1 2 +1 2 3 +1 2 3 4 +1 2 3 4 5 +#include +using namespace std; +int main() +{ + int rows; +cout << "Enter number of rows: "; + cin >> rows; +for(int i = rows; i >= 1; --i) + { + for(int j = 1; j <= i; ++j) + { + cout << "* "; + } + cout << endl; + } + return 0; +} +OUTPUT : +* * * * * +* * * * +* * * +* * +* +#include +using namespace std; +int main() +{ + int rows, number = 1; +cout << "Enter number of rows: "; + cin >> rows; +for(int i = 1; i <= rows; i++) + { + for(int j = 1; j <= i; ++j) + { + cout << number << " "; + ++number; + } +cout << endl; + } +return 0; +} +OUTPUT : +1 +2 3 +4 5 6 +7 8 9 10 +include +using namespace std; +int main() +{ +char row,col,ch; +int height; +cout<<"Enter the height of Triangle="; +cin>>height; for(row=1;row<=height;row++) { ch='A'; for(col=1;col<=row;col++) +{ +cout<