Questions:
Write a C++ Program to draw Right Triangle Shape
Explanation:
This Problem is just elaboration of nested loops.Below mention code is compiled in Visual Studio 2015 and output snap is attached.. If any problem you feel and want explanation feel free to contact :)
Code:
Output:
Related Articles:
C++ Shapes Codes
Write a C++ Program to draw Right Triangle Shape
Explanation:
This Problem is just elaboration of nested loops.Below mention code is compiled in Visual Studio 2015 and output snap is attached.. If any problem you feel and want explanation feel free to contact :)
Code:
/**************************************************|
/*************C++ Programs And Projects************|
***************************************************/
#include<iostream>
using namespace std;
void main() {
int value = 0;
cout
<< "Enter Value for the
size of Triangle = ";
cin
>> value;
int temp = value;
for (int i = 0; i < value; i++) {
for (int space = 0; space < i;
space++) {
cout
<< " ";
}
for (int star = 0; star < temp;
star++) {
cout
<< "*";
}
temp--;
cout
<< endl;
}
}
Output:
Related Articles:
C++ Shapes Codes
0 Questions:
Post a Comment