hello guys , i remember what kind of homeworks in java students get at the start so i started to post solutions in this even i had to do this when i was doing java (a diploma) our sir asked us to make a program that prints out a triangle using For Loops so i created my own answer but my sir showed us a different one it doesn't even looks like a triangle but it has the triangle shape but mine is exactly a triangle .
this is my answer , NOTE : the easiest and the best way to print a real triangle
86 comments
print the triangle using only two loops, and yes also don't use recursion concept! have a happy coding!
ReplyI love my iPad. iPad Air has iOS 7. Overall , my iPad is awesome and it is flawless to me.
ReplyYour lesson for printing the triangles are the same way for my iPad's remarks.
Nice
ReplyCan You Help Me With This Output?
Reply1
121
12321
that is not nested loop bro. for 123456789 try this :
Replypublic class Test
{
public static void main(String [] args)
{
for (int i=1; i<=9; i++)
{
System.out.println();
for (int j=1; j<=i; j++)
{
System.out.print(j);
}
}
System.out.println();
}
}
I am sorry, I am not doing programming anymore so I don't know how else I could help you :)
Thank you very much
ReplyIt really helped :)
can u help to print * diamond shape in java using for loop
Replyclass Diamond {
Replypublic static void main(String[] args) {
for (int i = 1; i < 10; i += 2) {
for (int j = 0; j < 9 - i / 2; j++)
System.out.print(" ");
for (int j = 0; j < i; j++)
System.out.print("*");
System.out.print("\n");
}
for (int i = 7; i > 0; i -= 2) {
for (int j = 0; j < 9 - i / 2; j++)
System.out.print(" ");
for (int j = 0; j < i; j++)
System.out.print("*");
System.out.print("\n");
}
}
}
/*
*
***
*****
*******
*********
*******
*****
***
*
*/
source : *http://www.java2s.com/Tutorial/Java/0080__Statement-Control/PrintoutaDiamond.htm
hi there do have java code for printing do java in pattern like
ReplyD D
D D
D D
D D
like this total DO JAVA
not like that is mush be like
ReplyD\\D
D\\\\\\D
D\\\\\D
D\\\D
D
\ is space
how to make 'A' out of stars(*)
Replyplease some one help me I also need it
Replyhow to get this psttern
Reply555555
4444
333
22
1
55555
Reply4444
333
22
1
how to get pascal triangle
Reply1
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
How to print this output
Reply# # # # #
# # # #
# # #
# #
#
class Test
Reply{
public static void main(String args[])
{
for(int i=4;i>=1;i--)
{
for(int j=1;j<=i;j++)
{
System.out.print("#");
}
System.out.print("\n");
}
}
}
Write a program, which prints stars as triangles
Reply1.your program can print 3 diffrent triangles( left triangle, right triangle and centered triangle)
2. Your program ask the user, which kind of triangles has to be printed
( hint: use switch statment)
3. Your program ask the user, how many rows of stars the user want to print
if the user requires 3 the and left triangles, the out put should be like :
for (int i=4;i>=1;i--)
Reply{
for(int j=1;j<=i;j++)
{
System.out.print("*");
}
System.out.println();
}
for(int i=0;i<5;i+=2)
Reply{
for(int j=0;j<=i;j++)
{
System.out.print("*");
}
System.out.println();
}
for (int i=3;i>=0;i-=2)
{
for (int j=1;j<=i;j++)
{
System.out.print("*");
}
System.out.println();
}
What about as function for the implementation of the Triangle Classification Algorithm?
Replyhi guys can you help me draw this shape in for loop....
Reply*
*A*
*A*A*
can you help me draw pascal tringle without arrey
Replyfor(int j=5;j>0;j--)
Reply{
for(int i=0;i<j;i++)
{
System.out.print(j);
}
System.out.println();
}
}
for(int i=0;i<3;i++)
Reply{
for(int j=0;j<i*2+1;j++)
{
if(j%2!=0)
System.out.print("A");
else
System.out.print("*");
}
System.out.println();
}
for (int i=0; i<3; i++)
Reply{
for (int k=0; k<6-i; k++)
{
System.out.print(" ");
}
for (int j=0; j=0; i--)
{
for (int k=6-i; k>0; k--)
{
System.out.print(" ");
}
for (int j=i*2+1; j>0; j--)
{
System.out.print("*");
}
System.out.println("");
}
Can you please share with output, it will be helpful for us
Replyhow do i get this
Reply-----1-----
----333----
---55555---
--7777777--
-999999999-
How can i print this
Reply*
* *
* * *
* * * *
* * * *
* * * *
* * *
* *
*
well formed code simple and understandable thanks a lot
ReplyBest Selenium Training in Chennai | Android Training in Chennai | Java Training in chennai | Webdesigning Training in Chennai
core java examples
Replybrack to band kaun kare ga munna ache se shikh lo uske baad kisi ko sikana
Replycan you help me how about this
Replyconvert this to java
int a,b;
for(a=1;a<=13;a++)
{
for(b=13;b>=a;b-=2)
{
cout<<"* ";
}
cout<<"\n\n";
}
system("PAUSE");
return 0;
}
Your site is truly intriguing and motivation to numerous. I'll looking forward for a greater amount of your posts. Keep it up!
ReplyCases Solutions
Great Information,it has lot for stuff which is informative.I will share the post with my friends.
ReplyMarketing Case Study
can you help me to print this?
Reply*
***
*****
***
*
Very informative article.Thank you author for posting this kind of article .
Replyhttp://www.wikitechy.com/view-article/java-program-to-print-floyds-triangle-example
Both are really good,
Cheers,
Venkat
Very informative article.Thank you author for posting this kind of article .
Replyhttp://www.wikitechy.com/view-article/java-program-to-print-floyds-triangle-example
Both are really good,
Cheers,
Venkat
class pattern
Reply{
void main()
{
for(int i=5;i>=0;i--)
{
for (int j=i;j>=1;j--)
{System.out.print(i);
}
System.out.println();
}
}
}
can you help me print this
Reply1 1
11 11
111 111
1111 1111
1111111111
Can you please help me print a parallelogram shape
Replyhelp with programming assignment
ReplyHello very cool website!! Guy .. Beautiful .. Amazing .. I’ll bookmark your site and take the feeds additionally? I’m satisfied to search out a lot of useful info right here in the post, we’d like develop more strategies on this regard, thanks for sharing.
My friend recommended this blog and he was totally right keep up the fantastic work!
ReplyNoise Engineering Homework Help
I’m really impressed with your article, Electric Circuits Electrical Assignment Help
Replysuch great & usefull knowledge you mentioned here
it's really nice and meanful. it's really cool blog. Linking is very useful thing.you have really helped lots of people who visit blog and provide them usefull information.
ReplyArticle Writing Service
ReplyI just put several of your products descriptions through copyscape and it looks like the descriptions you are using on your products are the exact descriptions that are being used on dozens of other sites on the web. I realize it's not fun to write content, but you cannot expect Google to rank your site higher than other websites when you have the exact same content as them. Use a service like contentastic.com or contentrunner.com to rewrite each products description to make your site more unique.
Dissertation Help
ReplyI loved the way you discuss the topic great work thanks for the share.
I personally like your post, you have shared good article. It will help me in great deal.
Replyessay writing
Thankyou for this wondrous post, I am glad I observed this website on yahoo.
Replycheck out this
Thankyou for this wondrous post, I am glad I observed this website on yahoo.
Replydownloadnicethingsblog.top
Thankyou for this wondrous post, I am glad I observed this website on yahoo.
Replydownlodable driver
Cupper has discovered the source of the infection, but she needs time. downloadallthingsfast.com Search through your available transcripts in this exclusive repository area using search criteria.
ReplyThen I use Synergy as 1) I paid long ago and 2) it is more solid (reliable and featured) than any one other app. downloadnowfreesoftware.com Each 5 spins takes off 1 minute from the next bonus reward time.
ReplySimply snap headstone photos using your GPS-enabled smartphone camera and fill in the person's details from a desktop computer later on. This link Find new photographers to follow or follow your friends and explore the world through the lens of the Steply community.
ReplySudden Unintended Acceleration occurred at the underground parking lot of an apartment complex. Go to website. Find them fast for great coin bonuses and use your coins for paint, playgrounds, landscaping, and more.
ReplyThe X disappears after 2sec, to be able to choose another place. downlodable manuals Des Enfants Metronome use 2 color flash lights for beat indication.
Reply1) Improvements of features:- Main Screen: move points. Get it! Simple little program that helps you practice, drill and quizzes the many Spanish verb conjugations.
Reply*
Reply*A*
*A*A*
Or if you want to buy or sell something then just tap MyCity. http://express-touristik.ru Once you select the kid's names, numbers, and cell phone companies you will never have to do it again.
ReplyOr if you want to buy or sell something then just tap MyCity. http://express-touristik.ru Once you select the kid's names, numbers, and cell phone companies you will never have to do it again.
ReplyOr if you want to buy or sell something then just tap MyCity. http://express-touristik.ru Once you select the kid's names, numbers, and cell phone companies you will never have to do it again.
Reply"Import From Google Docs" has moved to "Google Sync" menu and renamed to "Import Documents". topdownloadsoftwaredatabase.us On re-entering the application you will have the option to resume a saved game provided you have attained the save feature.
ReplyDo you have a registered team on Fantasy Premier League. download driver Select MCSA2 on Windows Server 2003 Part 2 from the App Store for the rest of the exam content - 70-227,70-228,70-351
ReplyAs the Civil War was drawing to a close, Lincoln became the first American president to be assassinated. download videos Many more features and improvements will be implemented in the near future.
ReplyContact, with the touch of a button, each county Emergency Management Agents who determine the travel status and share your feedback with them. link for you Please note: App subscriptions do not include access to subscription-only content on our website.
ReplyChanged default number of available racing tracks for new user profiles from 1 to 3. download videos I'm just a regular guy working odd jobs here and there, taking care of my 7mos old daughter.
Reply==PRICING==The Newsreel application is free and ad supported. downloadtorrentfromalexa.online Try it out and send us an email or visit our website and leave us a comment.
Reply: CivilWorks: Part of Your Civil Construction Team - FREE for 30-days. web site! You can print to a Wi-Fi printer or any printer attached to your Mac or PC shared on your home or business network.
Replyhow can i print this using for loop and scanner in java just don't mind the (-)
Reply*****
-****
--***
---**
----*
how can i print this using for loop and scanner in java just don't mind the (-)
Reply----0
---01
--012
-0123
01234
From Your Mobile Apps: Tom Swift and His Sky Racer by Victor Appleton. downloadthingsfromnora.pro Then, by having a wireless bluetooth keyboard at hand, I can rate songs by pressing a number key while cooking or working out.
ReplyEach one of the substance you said in post is excessively extraordinary and can be particularly significant. I will recollect it, an obligation of appreciation is all together to share the information keep overhauling, searching forward for more posts.Thanks Who Can Do My Assignment
ReplyI just put a couple of your things depictions through copyscape and no doubt the delineations you are using on your things are the right portrayals that are being used on a wide range of goals on the web. Can you Write my Research Paper
ReplyFrom Your Mobile Apps: Tom Swift and His Sky Racer by Victor Appleton. downloadthingsfromnora.pro Then, by having a remote bluetooth console nearby, I can rate melodies by squeezing a number key while cooking or working out. Someone Do my Assignment for Me
ReplyAmazing post
ReplyRegistry Reviver License Key
Thank You for Sharing Valuable Information. I like this blog and this is very informative.
ReplyNo.1 Electrical Project Center in Chennai | Electrical Project Center in Velachery
Good Tips share in this for print a triangle in java with loop.
ReplyYou can read my written article for getting tips for a good research paper.
good information to gain someknowledge
ReplySuperb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.
ReplyBest Web Designing Institute in Chennai
Best web designing course in chennai
web design classes
PHP Training Center in Chennai
PHP Institutes in Chennai
PHP courses in chennai
Post a Comment
Note: Only a member of this blog may post a comment.