Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Find the sum of prime numbers in an array {5, 10, 17, 23, 4, 9}.

Medium

Problem Statement

Find the sum of prime numbers in an array {5, 10, 17, 23, 4, 9}.

Sample Input

5 10 17 23 4 9

Sample Output

Sum of primes: 45

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
#include <stdio.h> int isPrime(int num) { // Prime check code } int sumOfPrimes(int arr[], int n) { // Sum of primes code } int main() { int arr[] = {5, 10, 17, 23, 4, 9}; printf("Sum of primes: %d\n", sumOfPrimes(arr, 6)); return 0; }
Log in or sign up to run or submit your code.Log inSign up
Input
5 10 17 23 4 9
Expected Output
Sum of primes: 45