guysss kindly help me with these problems .. :pleased: 4.1)Write a function int is_prime (int n) that returns 1 if n is prime and 0 otherwise. Hint: if k and n are positive integer, then k divides n if and only if n % k has value 0. 4.2) A famous conjecture, called the GOLDBACH conjecture, says that every even integer n greater than 2 has the property that it is the sum of two prime numbers. Computers have been used extensively to test this conjecture. No counter example has been found. Write a program that will prove that the conjecture is true for all the even integers between two input parameters, I and j, and returns a value of 1if and only if I and j are relatively prime. Otherwise, rel_prime should return a value 0 .. thanks in advance to those who will answer this D
Code: #include<stdio.h> int is_prime(int n); int main() { int n,flag; scanf("%d",&n); flag=is_prime(n); if(flag==1) { printf("prime"); } else { printf("not prime"); } } int is_prime(int n) { int i,flag=1; if(n==1) { flag=0; return(flag); } for(i=2;i<=n/2;i++) { if(n%i==0) { flag=0; break; } } return(flag); }