Functions and Recursions – Arithmetic – Problem #1

IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive

Difficulty: hard

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

Back to Lab Problems
Functions and Recursions/Arithmetic/Problem #1

Lab Problem Statement

Specifications & Problem DetailsIIT Kharagpur PDS Archive
Loading question...

Interactive C Compiler · Problem #1

WASM In-Browser

Runs directly on your machine · Zero remote server dependency

Compiler downloads on first Run (large, saved in your browser after that)
main.cCtrl + Enter to run
1
2
3
4
5
6
7
Input (stdin)given to scanf / cin
Output

Output appears here. Press Run to compile and execute.