Instructions:
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:
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
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
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.
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:
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