Write a program to calculate and display sum of the following series using for loop x+x2+x3+………xn
Create a flowchart that will solve the area of a rectangle given the length (l) and width (w) of a rectangle. If the length and width are equal, show that the rectangle is square.
Exercise 4: Practice to manipulate data in arrays
Write a C program that read numbers from an integer array and graph the information in the form of bar chart. The sample output is given below.
Element Value Histogram
0 19 *******************
1 3 ***
2 15 ***************
3 7 *******
4 11 ***********
5 9 *********
6 13 *************
7 5 *****
8 17 *****************
9 1 *
Exercise 1: Practice to store and print data in an array
a) Write a C program that reads marks of 10 students in to a single subscripted array.
b) Above marks should be between 0 to 20. Modify the above program to add marks to the array only if the input mark is between the given range.
c) Display the values stored in the array.
Exercise 2: Practice to access data stored in an array
Modify the above program to find the mean of the marks stored in the array.
Exercise 3: Practice to manipulate data in arrays
Write a C program to create an integer array called Motion of size 5. Ask the user to enter values to the array from the keyboard. Rotate the values of the array by one position in the forward direction and display the values.
Ex: number in index 4 should move to index 3, Number in index 3 should move to index2, number index 0 should move to index 4.
Initial values 10 6 8 2 9
After rotating 6 8 2 9 10
Make a struct LINE include appropriate data members.
A line segment includes the endpoints, i.e. the points that it joins.
structure should also provide a function to find the length of the Line
Two lines can be compared to determine which line is shorter and vice versa. Provide function to compare two Lines
Provide appropriate constructors for initialization.
Create a struct point to represent a point in cartesian coordinate system
provide member functions
default constructor
input
output
distance(returns the distance between two point objects, the function takes one object as an argument)
is zero(determines if a point is the center)
midlepoint (computes the middle point of an object from origin and returns the answer in a point object)
is equal to(compare two points)
isGreater than (compares two point in terms of the distance from the center)