-
Notifications
You must be signed in to change notification settings - Fork 1
OddNumberSeries.java #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
class DivisorSeries | ||
{ | ||
public static void main (String args[]) | ||
class Test | ||
{ | ||
static void printDivisors(int n) | ||
{ | ||
int i=2; | ||
while (i<=10) | ||
System.out.println(i+"/"+(i*i)+"\t"); | ||
i++; | ||
} | ||
while (i<10) | ||
{ | ||
System.out.print(i+"/"+(i*i)+"+"); | ||
i++; | ||
} | ||
System.out.print(i+"/"+(i*i)); | ||
} | ||
} | ||
for (int i=1;i<=n;i++) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The program I created has approach for basic users, You can keep it in two forms. |
||
if (n%i==0) | ||
System.out.print(i+" "); | ||
} | ||
|
||
public static void main(String args[]) | ||
{ | ||
System.out.println("The divisors of 100 are: "); | ||
printDivisors(100);; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good Program, you can comment some code as it improves code readability. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import java.util.*; | ||
public class Exercise48 { | ||
public static void main(String[] args){ | ||
for (int i = 1; i < 100; i++) { | ||
if (i % 2 != 0) { | ||
System.out.println(i); | ||
} | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename class to DivisorSeries.