1. Operations on numbers

I would like all the members here take part in this and contribute to this simple thread......

We all think differently....so we ll have different solutions to this simple problem.

I am searching for different logics that would generate the following numbers in an arbitary range say between UpperLimit and LowerLimit. (int UL,LL).

1. Armstrong Number

*2. Magic / Ramanujan Number [http://www.quickermaths.com/ramanujan-number/] << This is more important for me.

3. Krishnamurthy Number [A krishnamurthy number is one whose sum of the factorials of each number is equal to the number itself. Eg: 145]

2. Have you tried printing all the prime numbers between 10 pairs of values in less than 6 seconds, using an old Pentium II 700MHz processor?

3. I will translate for you:
Originally Posted by Avenger625
I would like all the members here take part in this and contribute to this simple thread......
I would like to have this done for me.
Originally Posted by Avenger625
We all think differently....so we ll have different solutions to this simple problem.
By "we" I mean "you", because I don't actually have any solutions, which is why I'm posting this.
Originally Posted by Avenger625
I am searching for different logics
I am searching for the actual full working program, because if all I wanted was the "logics" behind it, I would have found it on Google by now.
Originally Posted by Avenger625
*2. Magic / Ramanujan Number [http://www.quickermaths.com/ramanujan-number/] << This is more important for me.
This is my homework, so give me this one first!

Quzah.

4. Quote Originally Posted by Avenger625 View Post
I am searching for different logics
I am searching for the actual full working program, because if all I wanted was the "logics" behind it, I would have found it on Google by now.
Lemme add it to ur knowledge that u also get "full working program" on Google....Google it out....m sure u ll find a bunch of codes!!!

I was "actually" searching for various approaches and/or logics solving those problems!!!

Quote Originally Posted by Avenger625 View Post
*2. Magic / Ramanujan Number [http://www.quickermaths.com/ramanujan-number/] << This is more important for me.

This is my homework, so give me this one first!
If at all its my homework even then how does it bother you anyway if you do it on my behalf and help an ignorant kid to save his ass rather than "mis"-interpreting and translating my statements???

The second one is my homework that's why i posted it here and wanted it to be urgently done...that's what you had to say??!! Then why did I post the first and third one????

5. Originally Posted by Avenger625
Lemme add it to ur knowledge that u also get "full working program" on Google....Google it out....m sure u ll find a bunch of codes!!!
Of course I will. Hell, if I search for magic square here I get 70 threads.
Originally Posted by Avenger625
I was "actually" searching for various approaches and/or logics solving those problems!!!
No you weren't. You weren't looking for the logic behind it either, because you would have found it on Wikipedia in 2 seconds by typing in magic square.
Originally Posted by Avenger625
If at all its my homework even then how does it bother you anyway if you do it on my behalf
Read the homework policy. If I do it for you, you are still:
Originally Posted by Avenger625
an ignorant kid
Doing it for you doesn't cure ignorance.
Originally Posted by Avenger625
The second one is my homework that's why i posted it here and wanted it to be urgently done...that's what you had to say??!! Then why did I post the first and third one????
Maybe that one is due first. Or maybe the other two are extra credit. The fact is, you didn't read the homework policy, and you didn't post anything other than "come post here and do this for me".

Quzah.

6. Originally Posted by Avenger625
If at all its my homework even then how does it bother you anyway if you do it on my behalf and help an ignorant kid to save his ass rather than "mis"-interpreting and translating my statements???
Because you won't learn a darned thing from the "gifted code", but you'll pass your course and then one of us will get stuck with you asking us to cover your butt in the workplace later on... And I for one would absolutly not want you in my workgroup.

If you're going to take a programming course then you should learn to program. You should not be wasting our time while you learn how to beg.

The second one is my homework that's why i posted it here and wanted it to be urgently done...that's what you had to say??!! Then why did I post the first and third one????
Here... read this... Homework Policy ...

As with all people asking for help... show some initiative, post your code... If you are actually stuck (not lazy stuck) maybe we'll help you along. No initiative on your part? Well, there are lots of other forums you can try.

7. Avenger625, you can try and defend yourself all you like, but until you're respected the homework policy by posting actual code that we can help with, you'll probably just get mocked for not doing so. Respect the system and others will respect you. It doesn't matter what you say until you post some code of demonstrate that you're wanting some specific knowledge about a specific piece of coding you are stuck on. You must ask a specific question.

8. @ quzah: I see u are equally dumb as me....U always temme clicking arround google and wiki but u urself refrain to click a link beside "2". Did u realise i'm not behind "Magic Square"....click the link find out...!!!
@ all others: It WAS NOT my homework....i "REALLY" wanted different approaches solving those problems!!!
I said, "If at all it’s my homework even then how does it bother you anyway if you do it on my behalf and help an ignorant kid to save his ass rather than "mis"-interpreting and translating my statements???"
I meant, is not it waste of time to dissect whether it was someone's homework or something rather than posting some codes. quzah was so very sure that it was my homework so i said, thinking it to be my homework only, let him post his logic!!!

CommonTater:
Because you won't learn a darned thing from the "gifted code", but you'll pass your course and then one of us will get stuck with you asking us to cover your butt in the workplace later on... And I for one would absolutly not want you in my workgroup.
Don't you think C has become outdated for real-world development in the current scenario?? I will not say there are none but hardly there are organisations who develop using C. Everyone is running behind .NET and Java these days. And about my programming skills, I know what I can do and I know I will be hired without anyone covering my butt!!

So, to all u nerds....here is my logic..........

Code:
```  //krishnamurthy

#include <stdio.h>

int fact(int);

int main()
{
int u,l,t,s,i;
printf("Enter lower limit : ");
scanf("%d",&l);
printf("Enter upper limit : ");
scanf("%d",&u);
for(i=l;i<=u;i++)
{
t=i;
s=0;
while(t!=0)
{
s=s+fact(t%10);
t=t/10;
}
if(s==i)
printf("%d ",i);
}
}

int fact(int n)
{
return n==0?1:n*fact(n-1);
}```
Code:
```  //Armstrong

#include <stdio.h>
#include <math.h>

int main(void)
{
int l,u,i,t,d,s;
printf("Enter lower limit : ");
scanf("%d",&l);
printf("Enter upper limit : ");
scanf("%d",&u);
for(i=l;i<=u;i++)
{
t=i;
d=0;
while(t!=0)
{
d++;
t/=10;
}
t=i;
s=0;
while(t!=0)
{
s+=(int)pow(t%10,d);
t/=10;
}
if(i==s)
printf("%d ",i);
}

}```
I'm still working on the "Magic No." algorithm....its taking hell lot of time and its buggy too......look forward to post it soon.

From you nerds, I would like some better and optimized logic than those I posted