Write a program to print the sum of two numbers, A and B. If their sum is less than 10, otherwise print the product of numbers.
solution
Given
N number of days as input, write a program to convert N number of days to years (Y), weeks (W) and days (D).
solution
Write a program to print the sum of two numbers, A and B. If their sum is less than 10, otherwise print the product of numbers.
solution please
Diamond
Given an integer value
N, write a program to print a number diamond of 2*N -1 rows as shown below.
Input
The first line of input is an integer
N.
Explanation
In the given example, the number of rows in the diamond is
5.
So, the output should be
. . . . 0 . . . .
. . . 0 0 0 . . .
. . 0 0 0 0 0 . .
. 0 0 0 0 0 0 0 .
0 0 0 0 0 0 0 0 0
. 0 0 0 0 0 0 0 .
. . 0 0 0 0 0 . .
. . . 0 0 0 . . .
. . . . 0 . . . .
First Prime Number
You are given
The first line of input is an integer
In the given example of
5 integers
W pattern with *
Write a program to print
The first line is an integer
For
N = 5The output should be
* * * * * * * * *
* * * * * * * *
* * * * * *
* * * *
* *Solid Right Angled Triangle - 2
Given an integer number
The first line of input is an integer
In the given example, the solid right-angled triangle of side
5. Therefore, the output should be
*
* *
* * *
* * * *Inverted Solid Right Triangle
Given an integer number
The first line of input is an integer
In the given example the solid right angled triangle of side
4. Therefore, the output should be
* * * *
* * *
* *
*
Hollow Right Triangle
Given an integer number
The first line of input is an integer
In the given example the hollow right angled triangle of side
4. Therefore, the output should be
* * * *
* *
* *
*Example 4: Create a function that takes an argument. Give the function parameter a unique name. Show what happens when you try to use that parameter name outside the function. Explain the results.
Example 5: Show what happens when a variable defined outside a function has the same name as a local variable inside a function. Explain what happens to the value of each variable as the program runs.