Question #4415

Program that display an inverted triangle using nested for loop.


Please use basic functions only.. thanks

Expert's answer

#include "stdafx.h"
#include "iostream"

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
int size;
int z;
cout<<"Input size of triangle plz:"<<endl;
cin>>size;
z = size;
while(size)
{
& for (int i=0; i<size; i++)
& {
& & cout<<"* ";
& }
& cout<<endl;
& size--;
& for (int p = size; p<z; p++) // from Ukraine with love :)
& {
& cout<<" ";
& }
}
system("pause");

return 0;
}

LATEST TUTORIALS
APPROVED BY CLIENTS