Riya took part in a maths quiz competition. To win the prize money she has to solve a tricky question at the end.For a given list of integers, write a program where all the integers in a given index range to be added.
She will be given M multiple ranges, where she should print the sum of numbers for each corresponding range.
Note: The limits in the range are both inclusive.
Input
The first line f input is space-separated integers.
The second line of input is a positive integer M denoting the number of index ranges.
The next M lines contain two space-separated integers of the range.
Output
The output should be M lines.
Each line contains an integer that represents the sum for the corresponding ranges.
Sample Input1
1 3 4 5 6
5
3 5
Sample Output1
12
[Please test the sample test cases and send the screenshots].
Create a module series.py containing functions to determine Fibonacci series and Exponential series. Import the module created to make it accessible, and Call the functions of that module with module name . Demonstrate the access of functions in the module created.
#include <iostream>
#include <cstring>
using namespace std;
#define STR_MAX_SIZE 100
void preserveString(char*, int);
int main(void) {
char str[STR_MAX_SIZE];
cout << "Enter string: ";
fgets(str, STR_MAX_SIZE, stdin);
preserveString(str, strlen(str));
return 0;
}
void preserveString(char *str, int size) {
if(size > 0) {
for(int i = 0; i < size - 1; i++) {
cout << str[i];
}
cout << endl;
// TODO: Add the recursive case of the function here
}
}
please help me to add the recursive function thankyou
Create a class heater that contains a single integer field temperature. Define a constructor that takes no parameter. The temperature field should be set to the value 15 in the constructor. Define the mutates warmer and cooler, whose effect is to increase or decrease the value of the temperature by 5.
characters.asm: Construct an assembly language program that will accept any character then tells whether the entered character is an alphabet, a number, or a special symbol.
Month.asm: Construct an assembly language program that accepts month in number form then displays it in worded form. (Use A for 10, B for 11, and C for 12)
Example:
- Enter Month in number form: 6
Number 6 month form is June
Contest Teamld: AME1481
oblem Statement
lex likes to play with numbers. She gave you an integer N
Your task is to find the number of positive integers less than or equ al to N that have an odd number of digits
For example 143 contains 3 digits it satisfies the condition, whereas 32 has 2 digits does satisfy the condition.
Input Format
The first line contains a single integer N.
1≤N≤100000
22
mat
Objective:
Write a program that asks the user for the name of a file. The program should display
the last 10 lines of the file on the screen (the “tail” of the file). If the file has fewer than
10 lines, the entire file should be displayed, with a message indicating the entire file
has been displayed.
NOTE:
Using an editor, you should create a simple text file that can be used to test this
program.
26. Suppose that the tuition for a university is $10,000 this year and Write a program that computes the tuition in ten years and the total cost of four years"
increases 5% every year.
worth of tuition starting ten years from now. 27. Write a program that convert from kilograms to pounds, miles to kilometers, and from
hour to minutes based on the choice of the user. 28. Write a program that prompts the user to enter the number of students and each student's
name and score, and finally displays the student with the highest score and the student
with the second-highest score.
29. Write a program that prompts the user to enter the number of students and each student's name and score, and finally displays the name of the student with the highest score.
2. Write a float method triangle() that computes the area of a triangle using its two formal parameters h and w, where h is the height and w is the length of the bases of the triangle.
3. Write a float method rectangle() that computes and returns the area of a rectangle using its two float formal parameters h and w, where h is the height and w is the width of the rectangle.
4. The formula for a line is normally given as y= mx +b. Write a method Line() that expects three float parameters, a slop m, a y-intercept b, and an x-coordinate x. the method computes the y-coordinate associated with the line specified by m and b at x coordinate.
5. Write a method Intersect() with four float parameters m1.b1.m2,b2. The parameters come conceptually in two pairs. The first pair contains the coefficients describing one line; the second pair contains coefficients describing a second line. The method returns I
if the two lines intersect. Otherwise, it should return 0;