Sum of 1 series
Given integer
N as input. Write a program to print the sum of series 1 + 11 + 111 + .... N terms.
Input
The first line of input is an integer N.
Output
The output should be an integer representing the sum of series.
Explanation
Given
N = 4
The sum for first
4 terms is 1 + 11 + 111 + 1111
So the output should be
1234.
Sample Input 1
4
Sample Output 1
1234
Sample Input 2
5
Sample Output 2
12345
sample input 3
10
sample output3
1234567900Number of digits until N
Given an integer
N, write a program that prints the count of the total number of digits between 1 and N.
Input
The input is a positive integer.
Output
The output should be a single line containing the count of the digits up to the given number.
Explanation
Given
N = 10
From 1 to 9, each number contains a single digit. From 10 onwards, the numbers contain two digits.
So the output should be 9 + 2 =
11.
Sample Input 1
10
Sample Output 1
11
Sample Input 2
4
Sample Output 2
4
sample input 3
1000
sample output3
2893Day Name
Given day number
D as input, write a program to display the day name.
(1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday, 7 - Sunday)
Input
The first line of input is an integer
D.
Output
The output should be a string representing the day name.
Explanation
For example, if
D = 3 then, according to the day number, the day should be Wednesday.
Sample Input 1
3
Sample Output 1
Wednesday
Sample Input 2
2
Sample Output 2
Tuesday
Compute Hypotenuse
Write a program to find the hypotenuse
H of a right-angled triangle of sides A and B.
Note: Pythagoras theorem states that, for a right-angled triangle. Hypotenuse2 = A2 + B2
Input
The first line is an integer,
A. The second line is an integer, B.
Output
The output should be an integer.
Explanation
In the given example, the first side
A = 3, and the second side B = 4. To calculate the hypotenuse we use Pythagoras theorem.
According to Pythagoras theorem, hypotenuse2 = 32 + 42
Therefore, the hypotenuse value is
5. So, the output should be 5.
Sample Input 1
3
4
Sample Output 1
5
Sample Input 2
12
5
Sample Output 2
13
Print Integers - 3
Given an integer
N. Write a program to print integers from N to 1.
Input
The first line of input is an integer
N.
Explanation
In the given example,
N = 5 the integers from 5 to 1 are 5, 4, 3, 2, 1.
Therefore, the output should be
5
4
3
2
1
Sample Input 1
5
Sample Output 1
5
4
3
2
1
Sample Input 2
3
Sample Output 2
3
2
1
Solid Right Angled Triangle - 2
Given an integer number
N as input. Write a program to print the double triangular pattern of N lines using an asterisk(*) character as shown below.
Note: There is a space after each asterisk * character.
Input
The first line of input will contain a positive integer.
Explanation
Given
N = 4, there should be 2 triangular patterns with 4 lines each. So, the output should be
*
* *
* * *
* * * *
*
* *
* * *
* * * *
Sample Input 1
4
Sample Output 1
*
* *
* * *
* * * *
*
* *
* * *
* * * *
Sample Input 2
5
Sample Output 2
*
* *
* * *
* * * *
* * * * *
*
* *
* * *
* * * *
* * * * *
Given an integer value
The first line of input is an integer
In the given example
N = 5. Therefore, the output should be
*
* *
* * *
* * * *
* * * * *
* * * * * *
* *
* *
* *
* *
*what is input("")
Write a Python program that reads numbers from the user. Your program should stop reading in numbers when the number 99 is entered. It should then print out the sum of the numbers entered – do not include the value 99 when calculating your sum