Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Nirbhay Agarwal
2,852 PointsPrime 100 errors
class prime1To100
{
public static void main()
{
int i,k,j;
for(i=1;i<100;i++)
{
k=0;
for(j=2;j<i;j++)
{
if(i%j==0)
{
k=1;
break;
}
}
if(k==0)
{
System.out.println(i);
}
}
}
}
Steven Parker
243,656 PointsOr perhaps you only need to quote it properly — see the Markdown Cheatsheet pop-up below the answer area for instructions.
Including a link to the course page would be very helpful also.
Nirbhay Agarwal
2,852 Pointsclass Prime 1To100 {
public static void main(String[] args) {
int i,k,j;
for(i=1; i<=100; i++) {
k=0;
for(j=2; j<i; j++) {
if(i % j==0) {
k=1;
break;
}
}
if(k==0) {
System.out.println(i);
}}}}
Jason Anello
Courses Plus Student 94,610 Pointsfixed code formatting in question
Hi Nirbhay,
The following link will show you how to post code: https://teamtreehouse.com/forum/posting-code-to-the-forum
Nirbhay Agarwal
2,852 PointsNirbhay Agarwal
2,852 PointsCan you rewrite the code for me please its messy...