In: Computer Science
Algorithms appear almost everywhere in life. For example, a store clerk uses an algorithm with tasks such as scanning items, bagging groceries, and accepting your payment. Other algorithms, such as those that make up computer operating systems, are much more complex. In general, the goal of algorithm design is to complete a job in fewer steps. Create your own algorithm to complete a computing task. You can use C++, Java, or Python3 to create your algorithm.
Tips:
There are four steps to algorithm methodology. Discuss your algorithm design in relation to these four steps. Describe how you went through each step of the methodology to create your algorithm.
ALGORITHMS can be simply be explained in layman terms as a set of procedures to solve a problem .the approach can vary from a person to person and also dependent on the nature of the problem statement
it generally has 4 steps: design ,analyze,implement,experiment
since you have given me a choice of programming language,i would be using python 3
and the program i would be implementing as an example would be to find if a number is prime number or not.
step1)design
the main goal is to identify what is a prime number.prime is any number which has no other factors except itself and one.such is a requirement to be a prime number.eg. prime numbers=2,3,5,7,11,13,etc
non primes=4,6,8,9,10,etc
step2)analyze
step 3)implement
def isprime(n):
flag=0
if n<=1:
print("1 or 0 is invalid")
quit(0)
for i in range(2,n):
if n%i==0:
flag=1
if flag==1:
return True
else:
return False
print("enter an integer number")
try:
n=int(input())
except:
print("please enter a valid input")
quit(0)
res=isprime(n)
if res==False:
print(n," is prime")
else:
print(n,"is not prime")
i also attched a screnshot for your reference
for line by line explanation,please refer to the following screenshot
step4)experiment
for more clarification or further simplification of the program,please reach out in the comment section,
--------------------------fin--------------------------------------------
hope my answer was helpful