0% found this document useful (0 votes)
207 views3 pages

Develop An Algorithm To Print Four Fields of Your Bio-Data in A Million Times

The document provides examples of algorithms to solve various problems: 1. An algorithm to print bio-data fields a million times. 2. An algorithm to calculate the areas of 10 circles. 3. An algorithm to calculate the product of N integer numbers. It also provides algorithms to: 1. Calculate all possible roots of a quadratic equation. 2. Compute x^n where n is an integer. 3. Calculate the standard deviation of a sequence of real numbers.

Uploaded by

Rahnuray
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
207 views3 pages

Develop An Algorithm To Print Four Fields of Your Bio-Data in A Million Times

The document provides examples of algorithms to solve various problems: 1. An algorithm to print bio-data fields a million times. 2. An algorithm to calculate the areas of 10 circles. 3. An algorithm to calculate the product of N integer numbers. It also provides algorithms to: 1. Calculate all possible roots of a quadratic equation. 2. Compute x^n where n is an integer. 3. Calculate the standard deviation of a sequence of real numbers.

Uploaded by

Rahnuray
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

ALGORITHM

QUIZ

1. DEVELOP AN ALGORITHM TO PRINT FOUR FIELDS OF YOUR BIO-DATA IN A MILLION


TIMES.

STEP 1: Start

STEP 2: Input names, gender, occupation and country of residence

STEP 3: Initialize counter j=0

STEP 4: Print names, gender, occupation and country of residence

STEP 5: Increase j by j++

STEP 6: Repeat steps 2 then 4 for j<=10^6

STEP7: Stop

2. DEVELOP AN ALGORITHM TO CALCULATE THE AREAS OF TEN CIRCLES.

STEP 1: Start

STEP 2: Get radius r

STEP 3: Let pi=3.142

STEP 4: Compute area A= pi*r*r

STEP 5: Print area A

STEP 6: Repeat step 2 then to 5 in 10 times

STEP 7: Stop

3. DEVELOP AN ALGORITHM TO CALCULATE PRODUCT OF N INTEGER NUMBERS

STEP 1: Start

STEP 2: Input N

STEP 3: Set product= 1

STEP 4: Initialize counter j

STEP 5: For j=0, j<=N, j++

STEP 6: Input integer, say x


STEP 7: Compute product= product*x

STEP 8: Print product

STEP 9: Stop

SLIDE 34 ASSIGNMENT

1. DETERMINE AN ALGORITHM TO CALCULATE ALL POSSIBLE ROOTS OF A QUADRATIC


EQUATION.

STEP 1: Start

STEP 2: Input a, b and c

STEP 3: Initialize equation y=0

STEP 4: Let K be b*b – 4*a*c

STEP 5: If K=0

STEP 6: Then process x=-b/2*a

STEP 7: Print x1 and x2 as the same value of the roots

STEP 8: Else if K>0

STEP 9: Then compute x1= (-b+sqrt(K)/2*a) and x1=(-b-sqrt(K)/2*a)

STEP 10: Print x1 and x2

STEP 11: Else if k<0

STEP 12: Then declare error or math error

STEP 13: Stop

2. DEVELOP AN ALGORITHM TO COMPUTE x^n WHERE n IS AN INTEGER TYPE VALUE

STEP 1: Start

STEP 2: Input the value x and integer n

STEP 3: Process y = x^n

STEP 4: Print y

STEP 5: Stop

3. DEVELOP AN ALGORITM TO CALCULATE THE STANDARD DEVIATION OF A


SEQUENCE OF A REAL NUMBERS.
STEP 1: Start

STEP 2: Input numbers, say x1, x2, x3, x4,…,xn

STEP 3: Compute sum=(x1+x2+x3+x4+…+xn)

STEP 4: If the total number if input is n

STEP 5: Then the mean(X)= sum of inputs/n

STEP 6: compute variance(V)= (x1-X)*(x2-X)*(x3-X)*…*(xn-X)/N

STEP 7: Compute standard deviation(D)= sqrt(V)

STEP 8: Print standard deviation(D)

STEP 9: Stop

You might also like