Tuesday 13 August 2013

Upper Triangle Numbered

Upper Triangle Numbered:

In this post of shapes in c language, you will find the code to draw upper numbered triangle in C++ using "*". 

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:
  • 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 at 
 http://shapesinc.blogspot.com 
for 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;
else
         cout << " ";
}
cout<<endl;
}
}

Disclaimer:

These codes are meant to help you out in designing similar problems as discussed here 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:








Upper-Triangle-Numbered-Shapes-In-C


0 comments:

Post a Comment