Sum of N terms in Harmonic series
Given integer
N as input, write a program to display the sum of the first N terms in harmonic series.
The series is: 1 + 1/2 + 1/3 + 1/4 + 1/5 ... + 1/N (N terms).
Input
The first line of input is an integer
N.
Output
Print the sum rounded upto 2 decimal places.
Explanation
For
N = 5
The sum of first 5 terms in harmonic series is 1 + 1/2 + 1/3 + 1/4 + 1/5
So, the output should be
2.28.
Sample Input 1
5
Sample Output 1
2.28
Sample Input 2
3
Sample Output 2
1.83
An array is defined as a collection of homogenous elements stored in contiguous memory locations. From this background, you are given eight values obtained from some experiment conducted by a researcher to establish the weights in grams of insects after feeding them:
1.2, 1.4, 1.8, 1.7, 1.0, 1.2, 4.6 and 2.6. Write assembly program to accomplish the following tasks.
1.Calculate and display the total for the weights as recorded from the experiment (8 Marks)
2.Display the weight of second, second last and last weights as observed from the experiment. (7 Marks)
A quantity surveyor has requested you to design an application using a flowchart to estimate the amount of paint required to paint a cylindrical water storage tank. The tank will be painted on the interior surface only. Each square meter of the surface will need 1 liter of paint that costs KES 500. The labor cost for painting the tank is 1000 KES. The program should prompt user to enter radius and height of the tank in meters then pass these values to a procedure which calculate and display the surface area of the tank, amount of paint needed and total cost of the painting the tank. In this regard you are required to:
1.Draw a flowchart to represent this system (12 Marks)
2.Write an assembly program to implement the design in a) above. (8 Marks)
def character_element(n):
import string
if n in string.ascii_letters:
print('Letter')
elif n in string.digits:
print('Digit')
else:
print('Special Character')The Above code have two test cases, but they were not getting any expected output even one test case also. Please give me expected output. Thank you !
Question url link :-
https://drive.google.com/file/d/1iGIZxhoPoL67KNkroEgQpaIo3Vh8w7dE/view?usp=sharing
The test cases are below
Sample Input 1
9
Sample Output 1
Digit
Sample Input 2
A
Sample Output 2
Uppercase Letter
LARGEST PALINDROME
you are given an integer N . find the largest palindrome which is less than N .
INPUT
the input contains a single integer
OUTPUT
the output should be a single integer which is the largest palindrome that is less than the given input.
EXPLANATION
given N = 45
44 is the largest number which is a palindrome that is less than 45
SAMPLE INPUT 1
45
SAMPLE OUTPUT 1
44
SAMPLE INPUT 2
79
SAMPLE OUTPUT 2
77
Amlan has listed down the details of the students randomly,ie their names and physics marks.Now,he wants to rearrange the students details in alphabetical order keeping the constraint of the physics marks in descending order.provide a solution in c to him.
Write a function that take an array of number as input parameters and print the member that have remember of 4 when divided by 5
You are given a positive integer N. Your task is to find the number of positive integers K <= N such that K is not divisible by any of the following numbers 2, 3, 4, 5, 6, 7, 8, 9, 10.
With Explanation too!