Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone please help me write these five short java programming programs. Im really having a hard time with them. Thank you. Question 1 (Compute

Can someone please help me write these five short java programming programs. Im really having a hard time with them. Thank you.

Question 1

(Compute ) You can approximate by using the following series:

= 4(1 1/3 + 1/5 1/7 + 1/9 1/11 + +(-1) ^i+1 / 2i -1)

Write a program that displays the value for i = 10000, 20000, , and 100000.

(Hint: You should input the value of i from the user. Also note that the symbol i denoted here does NOT correspond to the variable i, we use as standard notation in loops.)

Question 2

(Perfect number) A positive integer is called a perfect number if it is equal to the sum of all its positive divisors, excluding itself. For example, 6 is the first perfect number because 6 = 3 + 2 + 1. The next is 28 = 14 + 7 + 4 + 2 + 1. There are four perfect numbers less than 10,000. Write a program to find all these four numbers.

Question 3

Write a program to print the pattern shown below

The number of lines (n) will be supplied by the user. For example, the following figure is for n = 9. You can assume that the user will always enter an odd number.

*

***

*****

*******

*********

*******

*****

***

*

Question 4

A Krishnamurthy number is a number whose sum of the factorial of digits is equal to the number itself. Given a number N as input. Write a program to check whether this number is Krishnamurthy number or not.

For example, 145 is a Krishnamurthy number since 145 = 1! + 4! +5!

On the other hand, 434 is not a Krishnamurthy number since 434 is not equal to 4! + 3! + 4!

Question 5

An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. Write a program to find all Armstrong number in the range of 0 and 999.

For example, 371 is an Armstrong number since 33 + 73 + 13 = 371.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

What constitutes good cause in the discharge of an employee?

Answered: 1 week ago

Question

How will the members be held accountable?

Answered: 1 week ago

Question

a. How will the leader be selected?

Answered: 1 week ago