Академический Документы
Профессиональный Документы
Культура Документы
HTTP://WWW.COURSEHOMEWORK.COM/PRODUCT/PRG-410-WEEK-5ASSIGNMENT/
Contact us at:
+1 315-750-4434
help@coursehomework.com
Problem 3: Write a program that asks the user for a positive integer value. The program should
use a for loop to get the sum of all the integers from 1 up to the number entered. For example, if the
user enters 50, the loop will compute the sum of 1, 2, 3, 4, ... 50.
Input Validation: Do not accept a negative starting number. Write the algorithm of a program that
reads two integers and outputs them in increasing order.
Problem 4: Write a program that uses a for loop to display the characters for the ASCII codes 0
through 127. Display 16 characters on each line.
Problem 5: Write a program using a do- while loop that lets the user enter a series of positive
integers. The user should enter -99 to signal the end of the series. After all the numbers have been
entered, the program should display
the largest and smallest numbers entered.
Problem 6: Write a program that generates a random number and asks the user to guess what
the number is. If the user's guess is higher than the random number, the program should display
Too[ high, try again. If the users guess is lower than the random number, the program should display
Too low, try again. The program should use a loop that repeats until the user correctly guesses the
random number. Read more on how to generate a random number.
Problem 7: Write a program that reads the score of a student in a subject and uses switch
statement to display his grade according to the following criteria:
Score Grade
>= 90 A+
80 89 A
70 79 B
60 69 C
50 59 D
< 50 F
Problem 8: Analyze the following input and output, and then write a program that uses nested for
loop to print such a pattern given an input. Example input/output shown below:
Input: 5 Input: 3
Output: Output:
********
********
********
*****
*****
Problem 9: Analyze the following input and output, and then write a program that uses nested for
loop to print such a pattern given an input. Example input/output shown below:
Input: 5 Input: 3
Output: Output:
********
******
****
**
*
Problem 10: Analyze the following input and output, and then write a program that uses nested
for loop to print such a pattern given an input. Example input/output shown below:
Input: 5 Input: 3
Output: Output:
**
****
******
****
*****
Problem 11: Analyze the following input and output, and then write a program that uses nested
for loop to print such a pattern given an input. Example input/output shown below:
Input: 5 Input: 3
Output: Output:
55555333
44444222
33333111
22222
11111
Problem 12: Analyze the following input and output, and then write a program that uses nested
for loop to print such a pattern given an input. Example input/output shown below:
Input: 5 Input: 3
Output: Output:
11111111
22222222
33333333
44444
55555
Problem 13: Analyze the following input and output, and then write a program that uses nested
for loop to print such a pattern given an input. Example input/output shown below:
Input: 5 Input: 3
Output: Output:
55555333
444422
3331
22
1
Problem 14: Analyze the following input and output, and then write a program that uses nested
for loop to print such a pattern given an input. Example input/output shown below:
Input: 5 Input: 3
Output: Output:
53
4422
333111
2222
11111
Problem 15: Analyze the following input and output, and then write a program that uses nested
for loop to print such a pattern given an input. Example input/output shown below:
Input: 5 Input: 3
Output: Output:
**
****
******
****
*****