programiing Essay

927 Words Nov 22nd, 2013 4 Pages
Programming Exercises
1: Write a program that creates an array with 26 elements and stores the 26 lowercase letters in it. Also have it show the array contents.
2: Use nested loops to produce the following pattern:
$ $$ $$$ $$$$ $$$$$
3: Use nested loops to produce the following pattern:
Note: If your system doesn't use ASCII or some other code that encodes letters in numeric order, you can use the following to initialize a character array to the letters of the alphabet: char lets[26] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
Then you can use the array index to select individual letters; for example, lets[0] is 'A', and so on.
4: Have a program request the user to enter an uppercase letter. Use
…show more content…
The program should then continue to prompt for limits and display answers until the user enters an upper limit that is equal to or less than the lower limit. A sample run should look something like this:
Enter lower and upper integer limits: 5 9 The sums of the squares from 25 to 81 is 255 Enter next set of limits: 3 25 The sums of the squares from 9 to 625 is 5520 Enter next set of limits: 5 5 Done
10: Write a program that reads eight integers into an array and then prints them in reverse order.
11: Consider these two infinite series:
1.0 + 1.0/2.0 + 1.0/3.0 + 1.0/4.0 + ... 1.0 - 1.0/2.0 + 1.0/3.0 - 1.0/4.0 + ...
Write a program that evaluates running totals of these two series up to some limit of number of terms. Have the user enter the limit interactively. Look at the running totals after 20 terms, 100 terms, 500 terms. Does either series appear to be converging to some value? Hint: –1 times itself an odd number of times is –1, and –1 times itself an even number of times is 1.
12: Write a program that creates an eight-element array of ints and sets the elements to the first eight powers of 2 and then prints the values. Use a for loop to set the values, and, for variety, use a do while loop to display the values.
13: Write a program that creates two eight-element arrays of doubles and uses a loop to let the user enter values for the eight elements of the

More about programiing Essay