Hollow Right Angled Triangle in C++ 4:
In this post of shapes in c language, you will find the code for constructing a Hollow top right corner right angled triangle in C++ using "*".
Purpose of this code of shapes in c:
The basic purpose of this code is to make our visitors aware how to use simple programming tools of C++ to draw shapes in c programming language.
This code has been posted to:
This code has been posted to:
- Help our visitors in drawing shapes in c++.
- Make them aware of the use of simple loops to create shapes.
- Helping them out for their different assignments to draw complex shapes.
Advantages of this code of shapes in c:
After thorough study of this code you will be able to:
- Easily understand the use of nested loops.
- Appropriate use of If Else conditions.
- Make a generic code that will be able to make a triangle of any desired size(// within the size limit of the console).
- A clear cut help in designing similar problems.
Code:
/* Join us athttp://shapesinc.blogspot.comfor more codes of shapes*/#include<iostream>using namespace std;int main(){cout << "Join http://shapesinc.blogspot.com for more codes of shapes\n\n";cout<<"CAUTION: The input should not be other than numerical values \n\n\a";int size=0;cout << "Enter the size of the hollow triangle\n";cin>>size;for(int i=0 ; i<=size ; i++){for(int j=0; j<=size; j++){if(i==0)cout<<"* ";elseif(j==i || j==size)cout<<"* ";elsecout<<" ";}cout<<endl;}return 0;}
Disclaimer:
We do not appreciate the submission of our codes in your assignments.These codes are meant to help you out in designing similar problems and provide you with a sense how to deal with such problems.Shapes in c will not take any responsibility for any sort of plagiarism case if you copy pasted our code in your final assignments.
Output:
The exact output of the above code is as follows: