Thursday, January 22, 2015

c++ creating triangle

here is the code for creating triangle on c++.

#include "stdafx.h"
#include <iostream>
using namespace std;
int main() {

for(int x=1;x<=7;x = x + 2) {
for(int zz=7;zz>=x;zz--) {
cout<<" ";
}
for(int y=1;y<=x;y++) {
for(int z=1;z<=1;z++) {
cout<<" ";
}
cout<<"*";
}
cout<<"\n";
}
cin.get();
cin.get();
return 0;
}



No comments:

Post a Comment

Designed By Seo Blogger Templates Published.. Blogger Templates