C++ Program for Printing Triangle using Stars

Program Code:

#include<iostream>
#include<conio.h>

using namespace std;
int main()
{
int i=0 , j  ,k =5;
while(i<5)
{
j= k;
while(j>0)
{
cout<<"*";
j--;
}
cout<<endl;
i++;
k--;
}
getch();
}

Output:

.exe file

No comments:

Post a Comment

Please disable your ad blocker to support this website.

Our website relies on revenue from ads to keep providing free content.