Results 1 to 8 of 8
 08012011, 03:18 PM #1Member
 Join Date
 Aug 2011
 Posts
 8
 Rep Power
 0
Idnk what to here >.< :( please help me in my threads
Problem 3: (Perfect.java)
Write a Java program that reads a positive, nonzero integer as input and checks if the integer is deficient, perfect, or abundant.
A positive, nonzero integer, N, is said to be perfect if the sum of its positive proper divisors (i.e., the positive integers, other than N itself, that divide N exactly) is equal to the number itself. If this sum is less than N, the number is said to be deficient. If the sum is greater than N, the number is said to be abundant.
For example, the number 6 is perfect, since 6 = 1 + 2 + 3, the number 8 is deficient, since 8 > 1 + 2 + 4, while the number 12 is abundant, since 12 < 1 + 2 + 3 + 4 + 6.
SAMPLE OUTPUT:
1.)Input N: 5
5 is deficient.
2.)Input N: 6
6 is perfect.
3.)Input N: 18
18 is abundant.
 08012011, 03:22 PM #2
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 13,525
 Blog Entries
 7
 Rep Power
 20
What does this mean? "Idnk what to here >.< :("
kind regards,
Joscenosillicaphobia: the fear for an empty beer glass
 08012011, 03:27 PM #3please help me in my threads
 08012011, 03:31 PM #4Member
 Join Date
 Aug 2011
 Posts
 8
 Rep Power
 0
aw sorry wrong grammar :( i dont know what to do here sorry :(
 08012011, 03:34 PM #5
I recommend you check out the link in my signature on asking questions the smart way. For starters, don't write gibberish, and don't spam multiple posts. It would also help to show some effort and, you know, ask an actual question. What you're doing is little more than cheating, and people don't usually help cheaters.
How to Ask Questions the Smart Way
Static Void Games  Play indie games, learn from game tutorials and source code, upload your own games!
 08012011, 03:36 PM #6
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 13,525
 Blog Entries
 7
 Rep Power
 20
 08012011, 04:00 PM #7Member
 Join Date
 Aug 2011
 Posts
 8
 Rep Power
 0
sir here is my program but i dont know if im correct i cant figure out how to make the no. of terms summed up i dont know the formula please help me ill admit myself im weak at programming but i like to be a programmer
Java Code:/* this program calculates PI using the Gregory series... */ import java.util.*; public class GregorySeries { public static void main(String[] args) { // get user input... double a; Scanner kbd = new Scanner(System.in); System.out.print("Input Limit: "); a = kbd.nextDouble(); double n = 41; while (n<0.005) { n++; System.out.println(n+ "No. of terms summed up:" ); } // ensure that the input value is valid... if (n < 1) { System.out.println("Please input a positive integer value."); System.exit(0); } // initialize variables... double pi = 0; // 'running' sum... double divisor = 1; // divisor for the current term boolean add = true; // flag whether to add or subtract // term from the running sum... int term = 1; // number of terms summed so far... while (term <= n) { // add or subtract the current term to or from the // running sum, as appropriate... if (add) { pi += 4 / divisor; } else { pi = 4 / divisor; } // update variables... divisor += 2; add = !add; term++; } // output calculated value of PI... System.out.println("\nCalculated Value of PI: " + pi); } }
Last edited by JosAH; 08012011 at 04:21 PM. Reason: added [code] ... [/code] tags
 08012011, 04:27 PM #8
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 13,525
 Blog Entries
 7
 Rep Power
 20
Similar Threads

Pls help me idnk what to do :((
By kissmeeq in forum New To JavaReplies: 6Last Post: 08022011, 12:53 AM 
How to use two threads
By rajan701v in forum Threads and SynchronizationReplies: 2Last Post: 07222011, 05:47 PM 
Threads and UML
By JUser in forum Advanced JavaReplies: 0Last Post: 09272010, 08:43 PM 
Threads
By Tanuck in forum New To JavaReplies: 5Last Post: 09212010, 02:44 AM 
Threads!
By rameshraj in forum Advanced JavaReplies: 1Last Post: 05042008, 04:11 PM
Bookmarks