Write a program that takes a number and prints its total digit count and also even digit sum.
INPUT | OUTPUT |
---|---|
542175 | 6 6 |
24680 | 5 20 |
135 | 3 0 |
Write a program that will take integers as inputs until the user enters a negative number. Then shows the user the sum of all ODD non-negative numbers that is entered.
INPUT | OUTPUT |
---|---|
4 7 45 9 2 0 0 5 8 -4 | 66 |
1 1 0 1 -1 | 3 |
Write a program that reads numbers until the entered number is greater than the previous entered number. Then print the average of all entered numbers except the last one. (with two decimal places) (At least two numbers will be entered)
INPUT | OUTPUT |
---|---|
5 4 3 3 8 | 3.75 |
5 4 3 3 8 7 5 9 | 3.75 |
1 2 | 1.00 |
100 54 46 2 3 50 | 50.50 |
Write a program which reads 2 integers from the user as the length of vertical and horizontal sides of a rectangle respectively. Then prints the rectangle with stars '*'.
INPUT | OUTPUT |
---|---|
3 4 | **** **** **** |
2 6 | ****** ****** |
Write a program which takes an integer N as input and prints a right triangle which consists of N many lines.
Input:
3
Output:
--*
-**
***
Input:
5
Output:
----*
---**
--***
-****
*****
Write a program that reads a positive integer number and prints "Prime" to the screen if the entered number is a Prime number, otherwise "Prime Not".
Write a program that reads two positive integer numbers and prints all the prime numbers between (inclusive) them. You may assume that the first entered number will always be smaller than the second number.
INPUT | OUTPUT |
---|---|
3 22 | 3 5 7 11 13 17 19 |
1 3 | 2 3 |
32 36 |