|
#81
|
|||
|
|||
|
Quote:
![]() |
|
#82
|
||||
|
||||
|
|
|
#83
|
||||
|
||||
|
|
|
#84
|
|||
|
|||
|
Quote:
Probably the most efficient one. They were looking for logic here rather than programing techniques...I mean I'm sure this answer wouldn't have ticked em off ![]() |
|
#85
|
|||
|
|||
|
Quote:
They wanted entry level guys to think in this manner:Sum of 1 to n = n (n+1) / 2 and then subtract...just what u said....bulls eye! Last edited by ajrulez : 8th February 2005 at 09:09 AM. |
|
#88
|
|||
|
|||
|
Here is the code for checking whether a no. is prime or not
let n be the no. int flag=0; for ( i=2;i<=n/2;i++) { if ( n % i==0) { flag=1; } } if (flag!=1) cout<<"The no. is prime"; else cout<<"The no. is not prime"; |
|
#89
|
||||||||
|
||||||||
|
Quote:
I like the hash solution best, btw |
|
#90
|
|||
|
|||
|
Wow..awesome Guys..nice to see that u kept the thread alive ...I too will keep on contributing ...but let me see what are u discussing.....................
![]() |