for loop

S

sej

hello buddy.how r u? i cant able to write a program to print first k
prfect number. perfect number is the sum of all factor less than equal
to tht number n which is equal to tht number,for example 6 is perfect
number, and its factor is 1,2,3 and 1+2+3=6. try to help by tomm. bye
have a nice time.take care.
 
H

Howard

sej said:
hello buddy.how r u? i cant able to write a program to print first k
prfect number. perfect number is the sum of all factor less than equal
to tht number n which is equal to tht number,for example 6 is perfect
number, and its factor is 1,2,3 and 1+2+3=6. try to help by tomm. bye
have a nice time.take care.

i m ok, thx. sugg: do ur own hmwrk. and spk englsh
 
R

Rolf Magnus

sej said:
hello buddy.

I'm not your buddy.
how r u?
Pardon?

i cant able to write a program to print first k prfect number. perfect
number is the sum of all factor less than equal to tht number n which is
equal to tht number,for example 6 is perfect number, and its factor is
1,2,3 and 1+2+3=6. try to help by tomm. bye
have a nice time.take care.

So which part of that do you have problems with? Show us what you have so
far.
 
J

John Harrison

sej said:
hello buddy.how r u? i cant able to write a program to print first k
prfect number. perfect number is the sum of all factor less than equal
to tht number n which is equal to tht number,for example 6 is perfect
number, and its factor is 1,2,3 and 1+2+3=6. try to help by tomm. bye
have a nice time.take care.

OK, well first you have to write a function which returns true if n is a
perect number and false otherwise.

bool is_a_perfect_number(int n)
{
...
}

and then you have to call it in a loop (maybe a for loop) so that you
call the function for successive integers.

Maybe you would need a few other functions such as, return true if a is
a factor of b.

bool is_a_factor(int a, int b)
{
...
}

Make sense so far? Well this is called programming, so have a go and if
you get stuck post your code back here.

john
 
H

Howard

Derek Baker said:
His email address is from India.

So? I'm not commenting on poor grammar or poor spelling, but the use of
phrases like "how r u?", "tht" for "that", and no capitalization to start
sentences. Those are not factors of his being from India, they're IM-speak,
the shorthand that (mostly) kids are using on their text messagers, etc.,
and it's annoying. In a field such as programming, why use such shorthand?
You can't program in shorthand, and if you want to communicate with others,
it's best to be clear.

"At least that's my opinion... I could be wrong."

-Howard
 
J

Jaspreet

Derek said:
His email address is from India.

So, what is that supposed to mean ? I am also from India. Please shed
some light on the cryptic sentence of yours.

The original post has nothing to do with the location. The fault lies
in the fact that 'sej' has used the same language he would have been
using in his IM world to post to a newsgroup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top