Answer:
// program in Python to check perfect number
#function to find number is perfect or not
def is_Perfect_Number(n):
#total variable
tot = 1
i = 2
#sum of all divisor of number
while i*i<=n:
if n%i==0:
tot = tot + i + n/i
if tot == n and n != 1:
return 1
i = i+1
return 0
#read until user enter a perfect number
while True:
#read integer
num = int(input("Input an integer: "))
#call the function
if(is_Perfect_Number(num)):
print(num,"is perfect number")
#if perfect number break
break
else:
print(num,"is not a perfect number")
#ask again
print("try again.")
Explanation:
Read number from user and then call the function is_Perfect_Number() with parameter "num".This will find the sum of all divisor of number.If sum is equal to number then it will return 1 else return 0.If the number is not perfect then it will again ask to enter a number until user enter a perfect number.
Output:
Input an integer: 24
24 is not a perfect number
try again.
Input an integer: 28
28 is perfect number
The principle or element of layout design is highlighted in an event poster in option i: The headline.
<h3>What are the elements of page layout?</h3>
The poster is known to be one that often uses a kind of hierarchy and centered text alignment as its element.
Note that it is one whose Lines of use is said to be made up of different kinds of type styles, sizes and others.
The simple elements of an advertising poster is made up of:
1. The headline.
2. The sub-head.
3. The body copy.
4. The caption.
The elements of page layout are visual hierarchy, visual flow, and others. Hence, the principle or element of layout design is highlighted in an event poster in option i: The headline.
Learn more about layout design from
brainly.com/question/2501083
#SPJ1
apply for financial aid for college or grad school.
Answer:
PROGRAM QuadraticEquation
Solver
IMPLICIT NONE
REAL :: a, b, c
;
REA :: d
;
REAL :: root1, root2
;
//read in the coefficients a, b and c
READ(*,*) a, b, c
WRITE(*,*) 'a = ', a
WRITE(*,*) 'b = ', b
WRITE(*,*) 'c = ', c
WRITE(*,*)
// computing the square root of discriminant d
d = b*b - 4.0*a*c
IF (d >= 0.0) THEN //checking if it is solvable?
d = SQRT(d)
root1 = (-b + d)/(2.0*a) // first root
root2 = (-b - d)/(2.0*a) // second root
WRITE(*,*) 'Roots are ', root1, ' and ', root2
ELSE //complex roots
WRITE(*,*) 'There is no real roots!'
WRITE(*,*) 'Discriminant = ', d
END IF
END PROGRAM QuadraticEquationSolver
Answer:
#HERE IS CODE IN PYTHON
#function to find length of shortest and longest string in the array
def fun(list2):
#find length of shortest string
mn=len(min(list2))
#find length of longest string
mx=len(max(list2))
#return both the value
return mn,mx
#array of strings
list2 = ['Ford', 'Volvo', 'BMW', 'MARUTI','TATA']
# call the function
mn,mx=fun(list2)
#print the result
print("shortest length is:",mn)
print("longest length is:",mx)
Explanation:
Create an array of strings.Call the function fun() with array as parameter. Here min() function will find the minimum string among all the strings of array and then len() function will find its length and assign to "mn". Similarly max() will find the largest string and then len() will find its length and assign to "mx". Function fun() will return "mn" & "mx".Then print the length of shortest and longest string.
Output:
shortest length is: 3
longest length is: 5