0% found this document useful (0 votes)
12 views

computer hard

The document provides algorithms and flowcharts for various tasks including making a mango shake, preparing tea, buying chocolates, adding two numbers, finding the product of two numbers, checking room temperature for covering tomatoes, determining if a number is positive or negative, and calculating profit or loss based on cost and selling prices. Each task is clearly defined with a step-by-step algorithm and corresponding flowchart. The focus is on problem definition, input requirements, processing steps, and expected outputs.

Uploaded by

pinkykumari58555
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

computer hard

The document provides algorithms and flowcharts for various tasks including making a mango shake, preparing tea, buying chocolates, adding two numbers, finding the product of two numbers, checking room temperature for covering tomatoes, determining if a number is positive or negative, and calculating profit or loss based on cost and selling prices. Each task is clearly defined with a step-by-step algorithm and corresponding flowchart. The focus is on problem definition, input requirements, processing steps, and expected outputs.

Uploaded by

pinkykumari58555
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

INTRODUCTION TO CODING

1. Define a problem, write an algorithm and draw a flowchart to prepare


a glass of chilled mango shake.
Defining the problem:
To prepare a glass of mango shake.
Algorithm:
Step 1 - Start
Inputs - Mango pulp,milk ,sugar and ice-cubes.
Step 2 - Churn mango pulp.
Step 3 - Add sugar and churn.
Step 4 - Add milk and churn the mixture.
Step 5 - Add ice cubes and churn the mixture.
Step 6 - Pour the contents in a glass.
Output- A chilled glass of mango shake is prepared.
Step7- Stop

Flowchart
Start

Inputs -Mango pulp ,sugar, milk


and ice cubes

Churn mango pulp

Add sugar and churn the mixture

Add milk and churn the mixture

Add ice cubes and churn the mixture

Output - Glass of chilled mango


shake

Stop
2. Define the problem and write an algorithm to prepare a cup of tea.

Defining the problem -To prepare a hot cup of tea.

Algorithm
Step 1- Start.
Inputs- Water,sugar,milk and tea leaves.
Step 2- Boil water and add sugar.
Step 3- Add tea leaves to the boiling mixture and let it boil again.
Step 4- Add milk to the mixture and let it boil to get the right colour.
Step 5- Put boiled tea in a cup.
Output- A hot tea cup.
Step 6- Stop

3.Define the problem,write algorithm and draw a flowchart to buy


chocolates from a market.
Defining the problem - To go to the market and buy chocolates.
Algorithm :
Step 1- Start.
Step 2- Think of the chocolates you like.
Step 3- Pick your purse.
Step 4- Visit a shop and buy chocolates.
Step 5- Return home.
Output- Chocolates of choice bought.
Step 6- Stop.
Flowchart

Start

Think of the chocolates , pick your purse

Visit a shop and buy chocolates

Return Home

Chocolate bought

Stop
4. Clearly define the problem ,write algorithm and draw a flowchart to
add any two numbers.
Defining the problem - To find the sum of any two numbers accepted
from the user.
Algorithm
Step 1- Start
Inputs- Accept any two numbers as input A and input B
Step 2- Let C= A+B
Step 3 - Display the output as C
Output - Sum is C
Step 4- Stop

Flowchart
Start

Input A,B

C=A+B

Display C

Stop

5.Define the problem , write algorithm and draw a flowchart to find


product of any two numbers.

Clearly defining the problem - To accept two numbers from the uses and
then find and display their product .
Algorithm
Step 1- Start
Inputs - Accept 2 numbers in A and B as Input A , B
Step 2 - Find product in C as C = A x B
Output - Display C
Step 3- Stop

Flowchart-
Start

Input A, B

C= A x B

Output -Display C

Stop

6. Define the problem , write algorithm and draw a flowchart to check


the temperature of the room. If the temperature is less than 32 then
cover the baskets of tomatoes otherwise leave the baskets uncovered.

Defining the problem - To decide to cover the baskets of tomatoes or


leave them uncovered , depending upon the room temperature .

Algorithm
Step 1 - Start.
Inputs - Room Temperature.
Step 2- Ask the question - is temperature > 32?
Step 2a - If yes , then leave the baskets uncovered .Go to step 3.
Step 2 b- If no, then cover the baskets of tomatoes.
Output- Baskets covered or uncovered as per the requirement .
Step 3- Stop.
Flowchart Start

Input Room temperatre


as T

Output
No Is Yes
T > 32 Output
Tomatoes are
Tomatoes left
covered ? uncovered

Stop

7.Clearly define the problem and write algorithm and to input /accept a
number and then find and display if it is positive or negative.

Defining the problem -To accept /input a non-zero number and then
check and display if the number is positive or negative

Algorithm
Step 1- Start
Input - Number as NUM
Step 2- Ask the question-
Is NUM > 0 ?
Step 2a -If yes then display NUM is positive. Go to Step 3.
Step 2 b - If no then display NUM is negative .
Output - NUM is positive or negative is determined.
Step 3 -Stop.

8. Clearly define the problem ,write algorithm and draw a flowchart to


accept cost price and selling price of a commodity and then calculate
Profit or loss.
Defining the problem -To input cost price as CP and selling price as SP.
Calculate the profit or loss based on CP and SP and display the same.
Algorithm
Step 1 - Start.
Inputs - Input CP and SP.
Step 2- Ask the question-
Is SP > CP?
Step 2 a -If yes then calculate Profit as SP-CP. Display Profit .Go to Step3
Step 2b- If no then calculate Loss as CP- SP. Display the Loss.Go to Step 3
Output -Profit or Loss is displayed .
Step 3- Stop
Start
Flowchart

Input CP,SP

No Yes
Is
Loss =CP -SP SP>CP ? Profit =SP-CP

Display Loss Display Profit

Stop

You might also like