Upper Triangle Numbered:
In this post of shapes in c language, you will find the code to draw upper numbered triangle in C++ using "*".
For more visit: draw triangle in c.
Purpose of this code of shapes in c:
The main purpose of this code is to help our visitors to understand how, to use programming tools of C++ in drawing shapes in this programming language.
The codes we post are meant to:
The codes we post are meant to:
- Teach them the basic structure of C++ programming.
- Help the visitors to understand the proper use of loops.
- Helping them out for their projects and assignments.
Advantages of this code of shapes in c:
After studying this code you will be able to:
- Use nested loops in your daily programming work.
- master your self in using IF and ELSE conditions.
- Make codes of different triangles of any desired size(// within the size limit of the console).
- Draw complex shapes in c programming.
For more visit: draw triangle in c.
Code:
Your desired is showed below.
/* 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 length=0;cout << "Enter the length of the upper triangle\n";cin>>length;for(int i=length, k=0; i>=0; i--, k++){for(int j=0; j<length+k; j++){if(j>i)cout << k;elsecout << " ";}cout<<endl;}}
0 comments:
Post a Comment