Design Patterns in Java where input n=4, output like
1
2 3
4 5 6
7 8 9 10 ?
2 3
4 5 6
7 8 9 10 ?
- Pattern is an underlying structure that organizes surfaces or structures in a consistent, regular manner. Pattern can be described as a repeating unit of shape or form.
- Given a positive integer n.The problem is to print the pyramid pattern as designed the sample code is given below.
Sample Code
import java.io.*;
class Wikitechy {
public static void main(String[] args) {
int val = 1, n = 4;
for (int i = 1; i <= n; i++)
{
for (int j = 0; j < i; j++)
{
System.out.print(val + " ");
val++;
}
System.out.println();
}
}
}
Java
Categorized in:
Tagged in:
Accenture interview questions and answers, alphabet pattern programs in java, Applied Materials interview questions and answers, Atos interview questions and answers, Capgemini interview questions and answers, CASTING NETWORKS INDIA PVT LIMITED interview questions and answers, CGI Group Inc interview questions and answers, character pattern programs in java, Chetu interview questions and answers, Ciena Corporation interview questions and answers, Collabera Technologies interview questions and answers, Dell International Services India Pvt Ltd interview questions and answers, diamond number pattern programs in java, diamond pattern programs in java, different star pattern program in java, FIS Global Business Solutions India Pvt Ltd interview questions and answers, Flipkart interview questions and answers, IBM interview questions and answers, Indecomm Global Services interview questions and answers, Infosys Technologies interview questions and answers, infrrd interview questions and answers, java number pattern programs examples, java pattern programs with explanation, java program to print pattern of numbers, java program to print patterns of numbers and stars, java program to print pyramid of numbers, java program to print pyramid pattern of stars, L&T Infotech interview questions and answers, Mphasis interview questions and answers, NetApp interview questions and answers, Oracle Corporation interview questions and answers, PeopleStrong interview questions and answers, Persistent Systems interview questions and answers, pyramid triangle program in java, RBS India De interview questions and answers, Reliance Industries Ltd interview questions and answers, reverse pyramid program in java, SAP Labs India Pvt Ltd interview questions and answers, Tech Mahindra interview questions and answers, UnitedHealth Group interview questions and answers, Virtusa Consulting Services Pvt Ltd interview questions and answers, Wells Fargo interview questions and answers, Wipro Infotech interview questions and answers