Make a program that will accept an integer and loop from 1 to that integer. Then, print all numbers from that range that are greater than 3.
Armstrong numbers between two intervals
Write a program to print all the Armstrong numbers in the given range
A to B(including A and B). An N-digit number is an Armstrong number if the number equals the sum of the Nth power of its digits.
Input
The first line has an integer
A. The second line has an integer B.
Output
Print all Armstrong numbers separated by a space.
If there are no Armstrong numbers in the given range, print
-1.
Explanation
For
A = 150 and B = 200
For example, if we take number 153, the sum of the cube of digits
1, 5, 3 is
13 + 53 + 33 = 153.
So, the output should be
153.
Sample Input 1
150
200
Sample Output 1
153
Sample Input 2
1
3
Sample Output 2
1 2 3
please provide correct output in sample output 2
please provide correct output in sample output 3
the above output 3
input=10
input=15
• Write a function for checking the speed of drivers. This function
should have one parameter: speed.
• If speed is less than 70, it should print "Ok".
• 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"
• If the driver gets more than 12 points, the function should print:
"License suspended"
by CodeChum Admin
I'm really fond of even numbers, you know? That's why I'll be letting you make another even number problem yet again. This time, you need to print from a range of two inputted numbers, n1 and n2 (inclusive), all the even numbers from n2 down to n1, in descending order.
How about that?
Input
by CodeChum Admin
For those of you who may not now, a factorial is a product of multiplying from 1 until the number. Now, you must make a program that will accept an integer and then print out its factorial using loops.
Are you up for this task?
by CodeChum Admin
The greatest common divisor, also known as GCD, is the greatest number that will, without a remainder, fully divide a pair of integers.
Now, I want you to make a program that will accept two integers and with the use of loops, print out their GCD. Make good use of conditional statements as well.
Off you go!
Fibonacci sequence is defined with an integer n as,
F(n)=F(n-1)+F(n-2) for n ≥2,where F(0)=0,F(1)=1.
develop a Python program to compute F(n) for a given integer between 0 and 20.
Input: Output:
0≤n≤20 F(n)≤2 to the power32
Compute F(n) starting with n=2 and increment iteratively until the required value is obtained.
instructions-
Create a text file include the value ofn. The text file needs to saved in same folder
where the source file has been saved. The file name will be given as input through terminal.
Develop a function named“getNum"to read number n from file.
Develop a function named “show” to display the given value n and computed value
of F(n) on screen. (Expected output format Fibonacci(3) = 2)
Develop a function “saveFile” to write what was displayed in (3) above to a text
file named"result.txt”. This file should be in same folder where source file is.
program must call suitable functions to do the task.
if n>20 print invalid