![]() |
prime number program in C
Hello all i am so new and trying to learn while i serve.
I am supposed to write a program that prints out the first n primes, where n is input by the user. I am supposed to write my program in its own directory in three files: primes.h, main.c, and is_prime.c This is what the output is supposed to look like: PRIMES WILL BE PRINTED. How many do you want to see? 3000 Code:
1: 2is_primes.h: Code:
#include <stdio.h>Code:
#include "primes.h"Code:
#include "primes.h" |
Re: prime number program in C
Please use the Code Block when you have code in the posts
Give an appropriate Title. Your title said Visual Basic and you gave the code of C/C++. I edited it for you. You just happen to post in Introduce yourself and I moved to C-C++ for better response. Also you had the same post as an article of C-C++ |
Re: prime number program in C
Checkout this thread http://www.go4expert.com/showthread.php?t=2049 , I hope this will be of help!
|
Re: prime number program in C
It depends on your compiler. Read your compiler instructions, then if you don't understand them, post back, naming your system and compiler.
|
Re: prime number program in C
You need to compile them together or what?
if yes, one way is to copy "is_primes.h" and "is_prime.c" in libraly of Builder or visual studio(if you have) to "include" - you ll find it , where your program(builder/studio) is installed. if you cant (so you have linux and "vim"), then you collect ALL this programs in compiling directory and write, as usual , "gcc..." |
| All times are GMT +5.5. The time now is 17:39. |