archives
Home > archives (Page 13)
Posted at 02:08h
in
archives
by admin
Question 1:
Input a string using scanner and replace all vowels with the letter “#”
Input:
apple
Output:
#ppl#
Question 2:
Input a string using scanner and print the reverse of the string
Input:
apple
Output:
elppa...
Posted at 03:04h
in
archives
by admin
Question 1:
A store is having a sale. They’re giving 10 percent off purchases of $10 or lower, and 20 percent off purchases of greater than $10. Write a program that asks the purchase price and displays the discount (10% or 20%) and the final price.
Question 2:
You...
Posted at 01:32h
in
archives
by admin
Question 1:
Input a string using scanner and count the number of vowels and consonants in the string.
[assume there are no capital letters in the string]
Question 2:
Input a string using scanner and remove all the vowels from the string
Sample Input 1
abcd
Sample Output 1
bcd
Sample Input 2
apple
Sample Output...
Posted at 01:48h
in
archives
by admin
Question 1.
Use EasyGui to write a program to convert temperatures from Fahrenheit to Celsius. The formula for that is: Celsius = 5 / 9 * (Fahrenheit - 32). Use GUI input and output. You need to create a easygui enterbox to ask Fahrenheit, then...
Posted at 23:28h
in
archives
by admin
Question 1:
Input a number using scanner and print the factorial of that number.
E.g. Factorial of 5 is 1 * 2 * 3 * 4 * 5 =120
Question 2:
Create a loop between 1 to 20. Print “fizz” if the number is divisible by 3 and “bizz”...
Posted at 18:07h
in
archives
by admin
Question 1.
Use float() to create a number from a string like '12.34'. Make sure the result is really a number!
Question 2.
Try using int() to create an integer from a decimal number like 56.78. Did the answer get rounded up or down?
Question 3.
Try using int() to create...
Posted at 01:48h
in
archives
by admin
Question 1:
A store is offering a discount of 20% on purchase of more than 400$ and 10% on purchase of more than 200$ and a discount on purchase of more than 100$. Print the final amount you have to pay based on the discount.
Question...
Posted at 21:13h
in
archives
by admin
Question 1
Make a variable and assign a number to it (any number you like). Then display your variable using print.
Question 2
Modify your variable, either by replacing the old value with a new value, or by adding something to the old value. Display the new value using print.
Question 3
Make...