A Prime number an integer which is divisible only by 1 and itself.In other word a whole number who have two factor 1 and the number itself.
For example 2, 3, 5, 7, 11, 13, 17, 23, ...
Here we make a user defined function primecheck() that will check and print all the prime numbers between the given interval.
PROBLEM STATEMENT:
Write a Program in C to find prime numbers between intervals using functions.SOURCE CODE:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #include |
OUTPUT:
If the user's first number is greater than the second number then the numbers need to be swapped first.
More topics on C programming:
- C program to display Fibonacci series up to n termsC Program to display Fibonacci series up to a certain number
- C Program to display the Factorial of a number
- C Program to find prime numbers between intervals using function.
- C Program to check whether a number is perfect or not
- C program to identify a number as Even or Odd
- C program to print "Hello World"
No comments:
Post a Comment