473,396 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

help for turbo c++ program-amicable numbers

somebody plz help me with a program for inputing two numbers and then checking if they are amicable or not. i've just started learnign c++ and we are being made to use turbo c++ 3.0 we have been taught only very basic commands such as cout,cin,if-else,for,clrscr,getch,gotoxy and some mathematic commands such as pow and sqrt. plz guide me. i can't figure out how to start. i am not asking for a written code. i just need some guidance. help would be greatly appreciated.
May 2 '07 #1
3 3808
svlsr2000
181 Expert 100+
Quite intresting. you can find more about amicable numbers here
http://en.wikipedia.org/wiki/Amicable_number

One of the apporach would be to write a function to find the sum of all all proper divisor. In c you can find whether a number is proper divisor or not by using % operator.

x%y is equal to zero if y is proper divisor of x.
May 2 '07 #2
Quite intresting. you can find more about amicable numbers here
http://en.wikipedia.org/wiki/Amicable_number

One of the apporach would be to write a function to find the sum of all all proper divisor. In c you can find whether a number is proper divisor or not by using % operator.

x%y is equal to zero if y is proper divisor of x.
i know what is an amicable number!! i also know about the %(modulus) operator and its function but i can't figure out how exactly to use it.
May 2 '07 #3
JosAH
11,448 Expert 8TB
i know what is an amicable number!! i also know about the %(modulus) operator and its function but i can't figure out how exactly to use it.
Here's a start:
Expand|Select|Wrap|Line Numbers
  1. int sumdiv= 0;
  2. for (int divisor= 1; divisor < x; divisor++)
  3.    ...
It's your turn now ...

kind regards,

Jos
May 2 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: git_cs | last post by:
Hey, guys and gals Somedays ago, I had asked for the DES algorithm in C language. Although I have written the algorthim in C myself, I am facing a peculiar problem, which I hope some of u guys and...
1
by: frzeeeze | last post by:
Hello, I have got three .C files in my program. And I am including a header file myheader.h which has a few common functions. However the code implementation of the header file is not available...
7
by: marek | last post by:
Dear colleagues, for one project, I need to link Turbo (or Borland) Pascal with (Turbo) C code. I would strongly like to avoid rewriting (my) C routines to Pascal (other part of project is under...
2
by: tuan_vandyk | last post by:
Hi I desperately need help with my project. Theoretically everything should work bu it just isn't. Please email me for a copy of the project's source code. It was made in Turbo C++ 5. Please if...
4
by: Hiten | last post by:
hi all, this is my 1st message. i am a beginner in C. can anyone help me out with the following Turbo C problem. i am unable to complile my programs. i.e. instead of compiling my program the...
1
by: conman | last post by:
Hello I am trying to debug my exe using the borland turbo debugger, but I keep getting an error saying "not enough memory to load program"!!. Does anyone know a way around this problem?? My exe is...
3
by: postrishi | last post by:
Hello Everybody , I am a new user. I am currently using Turbo C++ 3.0 editor in my engg.Can you tell me or post me a ebook on turbo c++ and NOT on c or C++.MInd it I want a book on TURBO C++ editor...
5
by: shanti | last post by:
hai, i have developed a c-code to push integers into a stack (an array). in the program there are three inputs which has to be given through keyboard. the inputs are "choice", "option","S_R_NO"...
3
by: Untitled123 | last post by:
Hey guys!! I am Planning on Creating a Computer vs. User Chess game involving Artificial Intelligence... by just using TURBO C++ This is NOT impossible!! Please understand that my seniors...
16
by: Gabriel | last post by:
Hi, I'm using Turbo C 2.01 and im stuck with this problem. I've reduced it to the following. My code in Turbo C is this: void f(char *); char h = "hello";
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.