Functions and Recursions – Arithmetic – Problem #1
IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive
Problem Statement
Write the following functions: 1. isprime () takes an integer number as input, returns 1 if the number is prime, and 0 otherwise. 2. sumoftwoprimes () takes an integer number x as input. It returns 1 if the number can be written as the sum of two prime numbers, and 0 otherwise. 3. arraysum2p () takes as input two numbers a and b, an array X and its maximum size. It creates an array containing elements between a and b that can be written as the sum of two prime numbers. Return the number of elements of the array. 4. Write a main() which does the following: 1. Declare array X containing 100 elements. 1. Read a, b from the user 2. Call arraysum2p() to create an array containing numbers between a and b that are the sums of two prime numbers 3. Print the array