given integer n as input.write a program to print the sum of series of 1+11+111+...n terms
by CodeChum Admin
Now that we're done with integers, we're moving on to decimals!
Instructions:
Input
A line containing three decimal numbers with two decimal places separated by a space.
1.53·2.25·1.23Output
A line containing the result with two decimal places.
2.80make a c ++ program ethat calculate the sum ,mean of series numbers
Create a class called Rectangle with data members: width, length and area. The class should have functions to allow for setting of both length and width, calculate the area, and retrieve the width, length and area.
Problem 1: Write a program that takes a positive integer as input and prints its factorial. Write two separate functions, one that computes the factorial iteratively, and the other recursively. Problem 2: Write a program to print the first n Fibonacci numbers. Write separate iterative and recursive versions. Which version do you suspect is more efficient ? Why ? Problem 3: Write a program that tests if a number is prime or not. Input a number from the user. The output should be ‘True’ if the number is a prime, ‘False’ otherwise. Problem 4: Write a program to sort a list of integers using Insertion sort, Mergesort and Quicksort. First take as input the size ‘n’ of the array, then read in the ‘n’ input integers that need to be sorted. Problem 5: Devise an experiment to verify that the runtime of the list index operator is indeed O(1), You might want to read sections 3.5 and 3.6 of Miller and Ranum’s online book.
Write a program to calculate the value of f(x) if u r given that f(x) =x+1, x<1
3x^2-x, x>1
10-x, x=1
Devise an experiment to verify that the runtime of the list index operator is indeed O(1), You might want to read sections 3.5 and 3.6 of Miller and Ranum’s online book.
Write a program to sort a list of integers using Insertion sort, Mergesort and Quicksort. First take as input the size ‘n’ of the array, then read in the ‘n’ input integers that need to be sorted.
Write a program that tests if a number is prime or not. Input a number from the user. The output should be ‘True’ if the number is a prime, ‘False’ otherwise.
Write a program to print the first n Fibonacci numbers. Write separate iterative and recursive versions. Which version do you suspect is more efficient ? Why ?