Star printing program in Java: pattern 8
A pattern program in Java is a program that uses loops and conditional statements to print a specific pattern or design on the console. These programs are often used to practice and improve programming skills and can range from simple patterns, such as triangles and stars, to more complex designs such as fractals and ASCII art. They can be implemented using basic programming concepts such as for loops, while loops, and if-else statements.
Star printing program in Java |
Code for this pattern:
public class star {
public static void main(String[] args) {
int i, j, k;
for(i=1;i<=5;i++)
{
for(j=i;j<5;j++)
{
System.out.print(" ");
}
for(k=1;k<(i*2);k++)
{
System.out.print("*");
}
System.out.print("\n");
}
for(i=4;i>=1;i--)
{
for(j=5;j>i;j--)
{
System.out.print(" ");
}
for(k=1;k<(i*2);k++)
{
System.out.print("*");
}
System.out.print("\n");
}
}
}
Try this in C.
public static void main(String[] args) {
int i, j, k;
for(i=1;i<=5;i++)
{
for(j=i;j<5;j++)
{
System.out.print(" ");
}
for(k=1;k<(i*2);k++)
{
System.out.print("*");
}
System.out.print("\n");
}
for(i=4;i>=1;i--)
{
for(j=5;j>i;j--)
{
System.out.print(" ");
}
for(k=1;k<(i*2);k++)
{
System.out.print("*");
}
System.out.print("\n");
}
}
}
Try this in C.
Really an interesting post om star printing in Java.Continue sharing more like this.
ReplyDeleteRegards,
JAVA Training in Chennai | JAVA course in Chennai
Day by day I am getting new things and learn new concept through your blogs, I feel very confident, thanks for your informative blog keep your post as updated one...
ReplyDeleteRegards,
JAVA Training in Chennai|J2EE Training in Chennai
Thanks for taking time to share this webpage.It is really interesting to read.Continue shares more.
ReplyDeleteRegards,
C Training in Chennai | C++ training | C and C++ institute
Nowadays, most of the businesses rely on cloud based CRM tool to power their business process. They want to access the business from anywhere and anytime. In such scenarios, salesforce CRM will ensure massive advantage to the business owners.Cloud Computing Training in Chennai
ReplyDeleteReally Nice Blog. Thank you for Sharing. We are the best erp software providers in chennai. For more details call +91 9677025199 or email us on info@bravetechnologies.in
ReplyDeleteERP Providers Chennai | ERP in Chennai
Nice posting
ReplyDeleteRed Hat Linux Training in Chennai
Red Hat Training in Chennai
Rhce Training in Chennai
Really nice post on Star printing program in Java.
ReplyDeleteJava Training in Noida
great java tips At SynergisticIT we offer the best java bootcamp in california
ReplyDeleteIt is so good to read a new article.
ReplyDeletejava interview questions and answers
selenium interview questions and answers
digital marketing interview questions and answers
hadoop interview questions and answers
oracle interview questions
data science interview questions and answers
Your article is really informative. Especially considering modern era of technology and world turning towards robotics, it will help many to learn from this article. Furthermore, if you want to have a look regarding communication technology you can visit the official site of VoIP Business and ca book your plan according to your need. To visit the site, clicke here.
ReplyDeleteReally awesome blog!!! I finally found great post here.I really enjoyed reading this article. Thanks for sharing your innovative ideas to our vision. your writing style is simply awesome with useful information. Very informative, Excellent work! I will get back here. . AWS Course in Chennai
ReplyDeleteThanks for the informative article. This is one of the best resources I have found in quite some time.
ReplyDeleteNicely written and great info.I really cannot thank you enough for sharing.
Reactjs Training in Chennai |
Best Reactjs Training Institute in Chennai |
Reactjs course in Chennai |
Thanks for sharing this wonderful article. Your article is very interesting to read. Explore the finest GCSE online tuition solutions with Ziyyara Edutech! Our expert tutors provide comprehensive support through interactive sessions, personalized learning plans, and exam-focused guidance.
ReplyDeleteFor more info visit GCSE online tuition
The information you have posted is very useful. The sites you have referred was good. Thanks for sharing. Ziyyara Edutech's expert tutors are dedicated to addressing difficulty grasping grammar rules, lack of conversational confidence, and challenges in comprehension.
ReplyDeleteFor more info visit Online classes for english
Post a Comment