Thursday, January 22, 2015
c++ create right triangle.
#include "stdafx.h"
#include <iostream>
using namespace std;
int main() {
int a;
cout<<"Enter N:";
cin>>a;
for(int x= 1;x<=a;x++) {
for(int y=1;y<=x;y++) {
cout<<"*";
}
cout<<"\n";
}
cin.get();
cin.get();
return 0;
}
#include "stdafx.h"
#include <iostream>
using namespace std;
int main() {
int a;
cout<<"Enter N:";
cin>>a;
for(int x= 1;x<=a;a--) {
for(int y=1;y<=a;y++) {
cout<<"*";
}
cout<<"\n";
}
cin.get();
cin.get();
return 0;
}
Labels:
cplusplus Tutorials
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment