(a) Ask the user to enter 5 integer values between 1 and 50. Create a simple bar graph using the character of your choice.
Hint: You may want to try to use a loop within a loop (a nested loop). Don't forget to indent properly! (2A)
For example: If the user were to enter 3, 1, 6, 2, 5, the output might look like:
***
*
******
**
*****
Extension:
(d) [challenge] Make the bar graph horizontal (2T)
Write a program in C# to get the largest element of an array using a function.
Test Data:
Input the number of elements to be stored in the array: 5
Input 5 elements in the array:
element - 0: 1
element - 1: 2
element - 2: 3
element - 3: 4
element - 4: 5
Expected Output:
The largest element in the array is: 5
We Filipinos are quite known for the habit of leaving at least one of the many pieces of food on the plate as it can't be equally divided among all at most times. Just like when 3 people decide to eat a pizza of 10 slices, there will often be at least one slice left on the box. To accurately show just how many pieces of things are left when divided by a certain number, we code it using modulo.
Care to do it for me?
Input
A line containing two integers separated by a space.
10·3Output
A single line containing an integer.
1Using Visual Studio, create a new Console App project.
Write a program that:
Asks the user to enter the final mark for a module; and
Displays the module result based on the following rules:
0 to 48 (inclusive) means the result is failed;
49 means that the result is passed (condoned);
50 to 73 means that the result is passed;
74 means that the result is distinction (condoned); and
75 to 100 means that the result is distinction.
Using Visual Studio, create a new Console App project.
Write a program that:
a. Asks the user to enter the final mark for a module; and
b. Displays the module result based on the following rules:
Create a console program that will perform the following:
• Ask the user to enter the pieces of apple.
• Ask the user to enter the total price of the apple(s).
• Print the total price of the entered pieces of apple(s).
• Convert the entered price into a whole number, then display the values of the original
price and the converted price.
Create a console program that will perform the following:
• Ask the user to enter the pieces of apple.
• Ask the user to enter the total price of the apple(s).
• Print the total price of the entered pieces of apple(s).
• Convert the entered price into a whole number, then display the values of the original
price and the converted price.
People who earn less than R6 000.00 or who are older than 70 years do not pay tax. Write a program that reads in a person’s salary and age. If the person should pay tax, your program should request the tax percentage. The program must finally display an appropriate message.
People who earn less than R6 000.00 do not pay tax. Write a program that reads in a person’s salary. If he earns R6 000.00 or more, the program must request the percentage tax the person pays. The program must then finally display one of the following messages (as an example): For a person who earns R1500.00 You do not pay tax, and your final payout is R1500.00 For a person who earns R8200.00 and whose tax is 10% You pay R820.00 tax, and your final payout is R7380.00
Write a program that prompts the user his balance as well as an amount to be withdrawn from his/her bank account. Display an error message if the amount is more than the balance; otherwise display the new balance.