Computer Science, asked by Anonymous, 3 months ago

Write an algorithm to print all whole numbers up to (n) ​

Answers

Answered by ᏞovingHeart
103

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Step by step descriptive logic to print natural numbers from 1 to n .

Input upper limit to print natural number from user. Store it in some variable say N .

Run a for loop from 1 to N with 1 increment. The loop structure should be like for \sf{(i=1; i<=N; i++)}.

Inside the loop body print the value of i

\LARGE\star\mathfrak{\underline{\underline{\purple{Learn~ more !! }}}}

In mathematics and computer science, an algorithm (/ˈælɡərɪðəm/ ( listen)) is a finite sequence of well-defined, computer-implementable instructions, typically to solve a class of problems or to perform a computation.

How to create

How to build an algorithm in 6 steps

  1. Step 1: Determine the goal of the algorithm. ...
  2. Step 2: Access historic and current data. ...
  3. Step 3: Choose the right model(s) ...
  4. Step 4: Fine tuning. ...
  5. Step 5: Visualise your results. ...
  6. Step 6: Running your algorithm continuously.

how to create an algorithm

In psychology, one of these problem-solving approaches is known as an algorithm. An algorithm is a defined set of step-by-step procedures that provides the correct answer to a particular problem. ... In some cases, you must follow a particular set of steps to solve the problem.

The Algorithm Problem Solving Approach in Psychology

algorithm in psychology

Run times

Array Sorting Algorithms

Algorithm ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀Time Complexity

⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀Best ⠀⠀⠀⠀⠀⠀Average

Heapsort ⠀⠀⠀⠀⠀ Ω[n log(n)]⠀⠀⠀⠀ Θ[n log(n)]

Bubble Sort ⠀⠀⠀⠀ Ω(n) ⠀⠀⠀⠀⠀⠀⠀Θ(n²)

Insertion Sort ⠀⠀⠀Ω(n)⠀⠀⠀⠀⠀⠀⠀ Θ(n^2)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Answered by aadil1290
13

Input upper limit to print natural number from user. Store it in some variable say N .

Run a for loop from 1 to N with 1 increment. The loop structure should be like for(i=1; i<=N; i++) . ...

Inside the loop body print the value of i .

Similar questions