:tongue: Hi there, I've written a c program in answer to the following question:
write a function prime that returns 1 if its argument is a prime number and 0 if it is otherwise.
My code is:
...
Type: Posts; User: avidrutham
:tongue: Hi there, I've written a c program in answer to the following question:
write a function prime that returns 1 if its argument is a prime number and 0 if it is otherwise.
My code is:
...
Hi there, I'm working on a c program that generates approximations of square roots based on newton raphson method. I worked out the approximations with another method I learnt and I know this...
Hi, laserlight, I know this is coming late but I finally figured how the second loop is working..Thanks for all your ideas. Also the code I pasted was incomplete. It does have ++i in the end.
Actually, what confuses me is that the print command is given before the test for multiples is done. So when we reach say p[4], which is set to 1 in the earlier loop, the test done on that is after...
Thank you for the response and please bear with me a little more. I observe that the code initializes all elements in p to 1 in the beginning. At this rate all no.s could have been printed as primes,...
:confused: I understand the sieve of eratosthenes on paper but in c code I find it hard to get the logic of using booleans like 1 and 0 to filter primes. In the code below, the algorithm for which is...
Thanks a ton...that sorted everything...This technique will help me even further
:D Hi I'm a newbie at programming working with stephen kochan's programming in C. I have an encountered a code in the book where I am unable to understand the output and utterly frustrated after...