Questions: 1 978

Answers by our Experts: 1 850

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Instructions:

  1. Input a non-zero positive integer.
  2. Using the same concept as the previous problem, figure out how to separate the digits of a number and determine which of the digits is the largest one, using a while. Afterwards, print the largest digit.
  3. Tip #1: Create another variable that will hold the largest digit. Initial its value to a negative integer, like -1, outside the loop.
  4. Tip #2: Everytime you get the rightmost digit, check if it is greater than the current largest digit. If it is, set it as the new largest digit.


Input


1. An integer

Output

The first line will contain a message prompt to input the integer.

The second line contains the largest digit of the integer.

Enter·n:·214
Largest·digit·=·4

Instructions:

  1. Input a non-zero positive integer.
  2. Using while loop, print out each digit of the inputted integer in separate lines, starting from its rightmost digit until the leftmost digit of the number.
  3. Tip #1: Use % 10 to get the rightmost digit. For example, if you do 412 % 10, then the result would be the rightmost digit, which is 2.
  4. Tip #2: On the other hand, use / 10 to remove the rightmost digit. For example, if you do 412 / 10, then the result would be 41.
  5. Tip #3: You'd have to repeat Tip #1 and Tip #2 inside the while() loop for this problem while the inputted integer is not yet 0.


Input


1. An integer

Output

The first line will contain a message prompt to input the integer.

The succeeding lines contain the digits of the integer.

Enter·n:·214
4
1
2
  1. Input a positive integer. This will serve as the starting point of the loop.
  2. Using a while() loop, print out all the odd numbers starting from the inputted integer, until 0. The outputted numbers must all be separated by line.
  3. Also remember that since the loop goes to descending order, a decrement variable shall be created and decreased per iteration for the loop to terminate when it reaches 0.

Input


1. An integer

Output

The first line will contain a message prompt to input the integer.

The succeeding lines contain the odd numbers.

Enter·n:·10
9
7
5
3
1
  1. Input a positive integer.
  2. Using while() loop, repeatedly print out the message "CodeChum is awesome" for the same number of times as that of the inputted integer. Each outputted message must be separated in new lines.
  3. Don't forget to make an increment/decrement variable that will increase its value per iteration so as to not encounter a forever loop and have errors, okay?

Write a program to display the multiplication table of the input number.

Midterm Exam

Do the following by using Recursion:


1. Create a code that can print any numbers depending on the inputted value of the user in ascending then reverse it in descending order.

Sample output:


Enter number: 5

1

2

3

4

5

4

3

2

1


2. Write a code that will identify if the inputted value is odd or even. If it is odd then get the sum of all the odd numbers prior to the inputted value, same goes if it is even then get the sum of all the even numbers.

Sample output:


Enter number: 9


Odd

The sum is: 25


3. Using the fibonacci sequence, create a code that will print the remainder using %5 of the sum of the 2 added value depending on the input term of the user.

Sample output:


Enter 1st term: 5

Enter 2nd term: 6


The sum is: 13

The remainder is: 3


Take the first element of the unsorted array and determine its final location in the sorted array (i.e., all values to the left of the element in the array are less than the element, and all values to the right of the element in the array are greater than the element). We now have one element in its proper location and two unsorted subarrays.


1. Are Integers Created Equally?

by CodeChum Admin

It's time to find out if something is true or false. Let's test your capabilities by creating a program that checks if two integers are equal!


Instructions:

  1. Input two integers in one line.
  2. Print the two integers in one line, and separate them with a space.
  3. Print a string message "Equal" on a new line, if both inputted integers are equal.

Input


1. First integer

2. Second integer

Output

The first two lines will contain message prompts to input the two integers.

The next line will contain the inputted integers.

The last line will contain a string which is the result, if the condition were true.



Create a program based on the attached output using a for loop.


Output:

Enter hidden number: 50

Set of how many attempts to allow the user to guess: 5

Enter your guess number: 45

Sorry! Your guessed number is lesser than the hidden number.

You have 4 attempts left.

Enter your guess number: 51

Sorry! Your guessed number is greater than the hidden number.

You have 3 attempts left.

Enter your guess number: 10

Sorry! Your guessed number is lesser than the hidden number.

You have 2 attempts left.

Enter your guess number: 17

Sorry! Your guessed number is lesser than the hidden number.

You have 1 attempts left.

Enter your guess number: 49

Sorry! Your guessed number is lesser than the hidden number.

You have 0 attempts left.

Sorry you failed to guess the number please try again later.


Write a program to calculate the sum of the following series:

  1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6 + 1/7 + ...  + 1/20






LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS