0% found this document useful (0 votes)
4 views5 pages

Java Challenge Programs

The document outlines five Java programming tasks. Each task involves specific input and output requirements, such as counting prime numbers with prime digit sums, summing unique elements in an array, adding two integers without using arithmetic operators, counting numbers within a range that do not contain a specific digit, and returning a string based on an integer input. The examples provided illustrate the expected functionality for each program.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Java Challenge Programs

The document outlines five Java programming tasks. Each task involves specific input and output requirements, such as counting prime numbers with prime digit sums, summing unique elements in an array, adding two integers without using arithmetic operators, counting numbers within a range that do not contain a specific digit, and returning a string based on an integer input. The examples provided illustrate the expected functionality for each program.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Program #1

• Write a Java program that accepts two integers


m and n and count all prime numbers between
m and n (inclusive) such that the sum of their
digits is also prime.
• Input: 10 25
• Output: 2
• Between 10 and 25 we have two prime
numbers 11 and 23 such that their sum of digits
is also prime.
Program #2
• You are given an integer array nums. Write a
Java program to return the sum of all unique
elements in the array.
• Input: [2, 1, 2, 3, 2, 1, 5]
• Output: 8
• 3 and 5 are the two unique elements in the
array and their sum is 8
Program #3
• Given two integers a and b. Write a Java
program to return the sum of a and b without
using the operator + or –
• Input: a = 4, b = 9
• Output: 13
Program #4
• Given three integers m, n and k. m and n been
the lower and upper range. Write a Java
program to return the count of such numbers
in this range which doesn’t contain k as any of
its digits.
• Input m = 120, n = 140, k = 2
• Output: 10
Program #5
• Given an integer num. Write a Java program to
return a string

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy