Write a program that prompts the user to enter the number of items and each item’s
name and price, and finally displays the name and price of the item with the lowest
price and the item with the second-lowest price.
by CodeChum Admin
There are different kinds of numbers, but among them all, the most commonly used numbers in our daily lives are those positive ones. So, I only want you to count all the positive numbers from the 4 inputted values and print out the result.
Go and search for the positive ones among these four!
Input
A line containing four numbers (may contain decimal places) separated by a space.
2·-4·3.6·1
Output
A line containing the total number of positive integers.
3
by CodeChum Admin
We've already tried comparing 3 numbers to see the largest among all, so let's try a more complicated mission where we locate where among the 5-digit integer is the largest one. There are only 4 possible cases for this mission:
Now, show me how far you've understood your lessons!
Input
A line containing a five-digit integer.
14632
Output
A line containing a string.
Middle
Is It You, Cody?
by CodeChum Admin
Can you identify if Cody's name is spelled right? If so, then make a program that accepts four one-letter strings separated by space and print "Correct" if the inputted strings, combined in order, spell the name Cody correctly. If not, print "Wrong".
It doesn't matter if it's in uppercase or lowercase, as long as it's spelled correctly, it's considered correct.
Now, will you take on this task?
Input
A line containing four one-letter strings separated by a space.
c·O·D·y
Output
A line containing a string.
Correct
Input two integers in one line, separated by a space. The first integer shall represent the starting point, and the other, the ending point.
Print out all even numbers that are within the range of the starting and ending point. Also keep in mind that the starting and ending numbers are also included in your even number evaluation!
The Greater One
by CodeChum Admin
Let us now try comparing two numbers by letting the user input two different numbers and say "Greater" if the first inputted number is greater than the second one, and "Lesser" if it’s the other way around.
Let's go!
Input
A line containing two different numbers separated by a space.
1.2·1.02
Output
A line containing a string.
Greater
Print out all numbers from 1 to 100 that is divisible by 3, each in separate lines, using a for loop.
The FizzBuzz Game
by CodeChum Admin
Let's play a game of FizzBuzz! It works just like the popular childhood game "PopCorn", but with rules of math applied since math is fun, right? Just print out "Fizz" when the given number is divisible by 3, "Buzz" when it's divisible by 5, and "FizzBuzz" when it's divisible by both 3 and 5!
Let the game begin!
Input
A line containing an integer.
15
Output
A line containing a string.
FizzBuzz
Input a random positive integer.
Using a for() loop, generate the factorial value of the integer and print out the result.Tip: Factorials work like this: Factorial of 5 = 1*2*3*4*5
Note that there is a special case and that is the factorial of 0 which is 1.
Input a random positive integer in one line. This will serve as the ending point of your loop.
Using a for() loop, loop from 1 to the ending point (inclusive) and perform the following statements:
If the number is only divisible by 3, print "Fizz"
If the number is only divisible by 5, print "Buzz"
If the number is divisible by both 3 and 5, print "FizzBuzz"
If nothing is true in the previous conditions, skip the number