Triangle Star Pattern
Pattern for N = 4
*
**
***
****
Note : There are no spaces between the stars (*).
Input format :
Integer N (Total no. of rows)
Output format :
Pattern in N lines
Constraints
0 <= N <= 50
CodingNinjas
author
2y

For odd number row, values are being displayed in increasing order and for even number row, values are being displayed in decreasing order. The only other trick is to how to iterate the loops.

CodingNinjas
author
2y
Space Complexity: Explanation: Time Complexity: Explanation:
Anonymous
2d
1
Anonymous
1mo
Hai
Anonymous
1mo
8
Thiruselvam
5mo
ex -
I m fresher
Given a number n the task is to print the star pattern in singing loop. Approach the idea is to . break a column into three parts and solve each . parts independently. Of the other. The triangle numbe...read more
Arti. Prajapati
1y

Given a number n the task is to print the star pattern in singing loop. Approach the idea is to . break a column into three parts and solve each . parts independently. Of the other. The triangle numbe...read more

Anonymous
2y
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n; n=s.nextInt(); int i=1; while(i<=n) { int j=; while(j<=i) { System.o...read more
MILAN SENAPATI
2y
#include
using namespace std;
int main(){
int N;
cout<<"enter N"<<endl;
cin>>N;
int i;
while (i<=N)
{
int j=1;
while (j<=i)
{
cout<<"*";
j++;
}
cout<<endl;
i++;
}
return 0;
...read more
Add answer anonymously...
Wipro Project Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter