Ask Experts Questions for FREE Help!
  Advanced
Register  |  Log in  
   Ask    
 Answer  
  Help  

Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
Free Answers in 3 Easy Steps

Register Now
3 Steps

At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.

Home > Computers & Technology > Programming > Compiled Languages > C++   »   coding a c++ program

 
Thread Tools Display Modes
Question
 
 
#1  
Old Oct 27, 2007, 05:40 PM
ziba
New Member
ziba is offline
 
Join Date: Oct 2007
Posts: 1
ziba See this member's comment history on his/her Profile page.
coding a c++ program

I need a fast help to code the following program which is really easy:

I have to develope a program to analyze one or more numbers entered by a user and see if the number is a prime # or a perfect # and out put a list of divisors of all perfect numbers and noneprime numbers.

Hint: A prime # is a # whose only exact divisors are 1 and the number itself(such 2,3,5,7) and a perfect # is a # whose exact divisors (except the number itself) sum to equal the number.(For example #6 has 3 divisors(not including 6). The divisors of 6(1,2,3)sum to equal the number.

I will appreciate your help if u give me the answer within 24 hours.

Reply With Quote
 
     

Answers
 
 
Old Oct 27, 2007, 06:05 PM   #2  
Full Member
asterisk_man is offline
 
asterisk_man's Avatar
 
Join Date: Nov 2006
Location: East coast of U.S.A.
Posts: 472
asterisk_man See this member's comment history on his/her Profile page.
we're not here to do your homework. next time try asking questions before the assignment is due tomorrow. We can help you with questions and review your answer but we won't do the work for you.

Comments on this post
cigogo agrees: You are right!
  Reply With Quote
 
     
 
 
Old Nov 22, 2007, 10:04 AM   #3  
Junior Member
red_cartoon is offline
 
red_cartoon's Avatar
 
Join Date: Nov 2007
Posts: 52
red_cartoon See this member's comment history on his/her Profile page.
If you are new to programming, then this is certainly not a good idea to start working on these problem just the day before submission. I hope you are in a much better situation than that.

For checking whether a number is prime or not, you run a loop i = 1 to i = sqrt(n) and see if i divides n without any reminder. If none of these can divide n without a reminder then n is prime.

For perfect number checking, loop from 1 to n and collect the divisors as you go through the loop. Add them to see whether they sum up to n or not. Thats it.
  Reply With Quote
 
     


Thread Tools
Display Modes

 
Similar Sponsors

Similar Threads
Question Asker Forum Answers Last Post
HTML Coding lchec k Internet & the Web 3 Aug 10, 2007 01:08 PM
color coding on line does not match jack color coding sailingyoho Landline Phones 9 Jun 5, 2007 10:39 AM
software coding boryanar Accounting 2 Apr 4, 2007 09:00 AM
Color Coding kulwinderjit Administrative & Clerical Support 1 Jan 19, 2007 06:56 AM
ignition coding pasfarda Cars & Trucks 0 Sep 12, 2006 11:34 AM




Copyright ©2003 - 2007, Ask Me Help Desk.
All times are GMT -8. The time now is 04:10 AM.