Questions: 5 831

Answers by our Experts: 5 728

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

The Fibonacci sequence is constructed by adding the last two numbers of the sequence so far to get the next number in the sequence. The first and the second numbers of the sequence are defined as 0 and 1. We get:

0, 1, 1, 2, 3, 5, 8, 13, 21…

 

Write a function which takes input as a number:

  • If the given number is a Fibonacci number, print the number
  • If the given number is NOT a Fibonacci number, print the sum of all Fibonacci numbers less than the given number.


int getFibOutput(int input) {

          // TODO: 

}

 

Example

(21 is a Fibonacci number)

Input: 21 Output: 21

(20 is NOT a Fibonacci number so, output is 10 (13+8+5+3+2+1+1)) 

Input: 20 Output: 33




Right Angled Triangle -3

Given an integer number N as input. Write a program to print the right - angled triangular pattern of N rows as shown below.


Input

The first line of input is a postive integer .

Explanation

For example the given number is 5 .

the output should be

______

|   /

|   /

|  /

| /

|/


 Even Out

by CodeChum Admin

You know, I was lying when I said the last time that numbers associated with 3 are my favorite, because the one I actually like the most in the world are even numbers! But to make things harder for you, you have to pick the even numbers from a range of two given numbers. Ha!

Now, let's try this one more time! 


Instructions:

  1. Input two integers in one line, separated by a space. The first integer shall represent the starting point, and the other, the ending point.
  2. Print out all even numbers that are within the range of the starting and ending point (inclusive or including the ending point).

Input

A line containing two integers separated by a space.

5·10

Output

A line containing integers separated by a space.

6·8·10

Given an integer number N as input. Write a program to print the right-angled triangular pattern of N rows as shown below

Explanation

For example, if the given number is

5, the output should be

______

| /

| /

| /

| /

| /


for example:

The input is 5. In the first row, we need to print N+1 underscores i.e.,6. After the row with underscores, we need to print the 5 rows. For every row from 2nd row to Nth row i.e; 5 starts with | and ends with /.



can you provide python code for this ?


thanks in advance


Write a program that allows a user to input 4 variables with decimal values only, checks for the largest amongst them, calculate their average and prints the output on screen

Write a program in Python that will store the schedule for a given day for a particular TV station. The program should ask the user for the name of the station and the day of the week before asking for the name of each TV program and the Start and Finish times.

Write a function for checking the speed of drivers. This function should have one parameter: speed.



1. If speed is less than 70, it should print "0k" .



2.



Otherwise, for every 5km above the speed limit (70), it should give the driver one demerit point and print the total number of demerit points. For example, if the speed is 80, it should print: "Points: 2" .



3.



If the driver gets more than 12 points, the function should print: "License suspended"

Find the greatest of 4 numbers using if-elif



Write a program that uses A LOOP to DISPLAY THE NUMBER OF CALORIES BURNED AFTER THE FOLLOWING INTERVALS: 10, 15, 20, 25, 30 MINUTES. USE IF STATEMENTS INSIDE THE LOOP FOR THESE INTERVALS



please include all of these