Question
Problem 1: (Multiples) Write a program that inputs two integers and determines and prints if the first is a multiple of the second. [ Hint:
Problem 1: (Multiples) Write a program that inputs two integers and determines and prints if the first is a multiple of the second. [Hint: Use the modulus operator.]
Problem 2: (Digits of an Integer) Write a program that inputs a five-digit integer, separates the integer into its individual digits and prints the digits separated from one another by three spaces each in reverse order.
[Hint:Use the integer division and modulus operators.]
For example, if the user types in 42339, the program should print 9 3 3 2 4
Problem3: ( Circle Formulas) Write a program that reads the radius of a circle as a positive integer , and computes and prints the diameter, the circumference and the area. Use the value 3.14159 for PI.
Problem4: (Sides of a Right Triangle) Write a program that reads three nonzero integers and determines and prints whether they could be the sides of a right triangle. [ Hint: Use Pythagorean formula , a*a +b*b = c*c
where a and b are side1 and side2 respectively, and c is the hypotenuse.
Provide four examples, two for yes case and two for no case.
Problem 5: ( Geometric Sequence and Series ) Write a program to generate a geometric sequence with first term a=1, and common ratio r = 0.5. Use a while loop to generate 10 numbers in the sequence. Also, find the finite sum of the resulting geometric series.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started