954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

c++ I did not understand

I have a question I did not understand if anyone of you understood it please explain to me

suppose that m and n are integers and m is nonzero. Recall that m is called a divisor of n if n=mt for some integer t; that is, when m divides n, the remainder is 0. moreover .m is called a proper divisor of n if m

and thank you a lot

MoOou
Newbie Poster
6 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

Do you have a problem with the math involved or the C++ involved? The easiest way to do the math you need using C++ is to use the modulo operator. Assuming m and n are both postive integers, if the result of m % n is zero then, n is a positive proper divisor of m according to the description you provided.

Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396
 

I have a question I did not understand if anyone of you understood it please explain to me

suppose that m and n are integers and m is nonzero. Recall that m is called a divisor of n if n=mt for some integer t; that is, when m divides n, the remainder is 0. moreover .m is called a proper divisor of n if m and thank you a lot


well ur inputted with a number for ex lets take the no 28 ( which is in ur ex)
1.(this one is for proper divisor )
u will have to find such nos that divide 28 completely i.e
28 % number = = 0
the remainder must be zero
thus you will land up in 1 , 2, 4, 7 , 14

2. then when u find these numbers , u will have to find the summation of these in such a manner that
their sum is equal to 28
i.e in this case 1+2+4+7+14 = 28

thus the number 28 becomes perfect positive number .

rahul8590
Posting Whiz
351 posts since Mar 2009
Reputation Points: 92
Solved Threads: 20
 

there is something I did not understand we prompt the user to put the numbers or one number only??
what's n=mt ??
we have to use if in these statement (m!=0)(m%n==0)(m

MoOou
Newbie Poster
6 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

[TEX]n=mt[/TEX] is the other way of writing that
[TEX]\frac{n}{m}=t [/TEX] where [TEX]t[/TEX] is a integer

it means that if you divide n by m, the division should leave no remainder.

>>we have to use if in these statement (m!=0)(m%n==0)(m>and we don't need to use loop, right??
No

You will have to use the loops for the first part of the question

siddhant3s
Practically a Posting Shark
816 posts since Oct 2007
Reputation Points: 1,486
Solved Threads: 140
 

well let me simply for you ..

1. accept number(`s in form of for loop or so ) and perfrom step 1 of my previous post .
you will land up with alll the divisors of that particular number (which will be the current number of for loop ) .
store it in some kinda array .

2. now check the summation of these numbers (which are divisors of the number inputted). if the add up to the number which is inputted , then the number which is inputted is perfect .

now re run the for loop and find such first 4 perfect numbers

rahul8590
Posting Whiz
351 posts since Mar 2009
Reputation Points: 92
Solved Threads: 20
 

can u please give us the full program for this question

"suppose that m and n are integers and m is nonzero. Recall that m is called a divisor of n=mt for some integers t; that is when m divides n, the remainders is 0,moreover,m is called a proper divisor of n if mwell let me simply for you ..

1. accept number(`s in form of for loop or so ) and perfrom step 1 of my previous post .
you will land up with alll the divisors of that particular number (which will be the current number of for loop ) .
store it in some kinda array .

2. now check the summation of these numbers (which are divisors of the number inputted). if the add up to the number which is inputted , then the number which is inputted is perfect .

now re run the for loop and find such first 4 perfect numbers

fefe
Newbie Poster
2 posts since Apr 2009
Reputation Points: 10
Solved Threads: 1
 

please help me to get the full program for writing this question
"suppose that m and n are integers and m is nonzero. Recall that m is called a divisor of n=mt for some integers t; that is when m divides n, the remainders is 0,moreover,m is called a proper divisor of n if m

fefe
Newbie Poster
2 posts since Apr 2009
Reputation Points: 10
Solved Threads: 1
 
input n
vector<int> factors
for(int i = 2; i <= n/2; ++n)
   //check if i is factor of n
   //if it is add it to the vector

//declare variable to act as running total and initalize to zero

//loop through vector adding elements together
for(int i = 0; i < size of vector; ++i)
    //add each element to previous total

//if n equals total from above loop, then n is a perfect number.
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You