SANJIVANI K. B. P.
POLYTECHNIC, KOPARGAON
With NBA ACCREDIATED programs , Approved by AICTE, New Delhi,
Recognized by Govt. of Maharashtra, Affiliated to Maharashtra State
Board of Technical Education, Mumbai, ISO 9001:2015 Certified
Institute
Department:- Computer Technology Class:- CM2I
Name of Subject:- Programming in C MSBTE Subject Code:- 22226
Name of Faculty: Prof. Vaibhav A. Parjane
1
Topic to be Covered
Examples of algorithms
Sanjivani K. B. P. Polytechnic, Kopargaon Department of Computer Technology Prof. Vaibhav A.
Parjane 2
Algorithm for Making Tea
Algorithm Name-Making Tea
Input- Water, Tea Leaves, Sugar, Gas, Stove, Utensil, Milk, cup.
Output- Tea
Step 1- Start
Step 2- Light gas.
Step 3- Boil Water in utensil, put tea leaves and sugar in it.
Step 4- After Boiling it properly put milk in it.
Step 5- After boiling it properly serve it in Cup.
Step 6- Stop
Sanjivani K. B. P. Polytechnic, Kopargaon Department of Computer Technology Prof. Vaibhav A. Parjane
4
Sanjivani K. B. P. Polytechnic, Kopargaon Department of Computer Technology Prof. Vaibhav A.
Parjane
5
Sanjivani K. B. P. Polytechnic, Kopargaon Department of Computer Technology Prof. Vaibhav A.
Parjane
6
Sanjivani K. B. P. Polytechnic, Kopargaon Department of Computer Technology Prof. Vaibhav A.
7
Sanjivani K. B. P. Polytechnic, Kopargaon Department of Computer Technology Prof. Vaibhav A.
Parjane
Algorithm for Arithmetic Operations
Algorithm Name-Arithmetic Operations
Input- Two Numbers
Output- Addition, Substraction,Division,Multiplication of two Numbers.
Step 1- Start
Step 2- Declare variable NUM1,NUM2,ADD,SUB,DIV,MUL.
Step 3- Read values of NUM1 and NUM 2.
Step 4- Do addition of numbers and store it in third variable i.e. ADD.
ADD NUM1+NUM2.
Step 5- Display ADD.
Step 6-Do Substraction of numbers and store it in third variable i.e. SUB.
SUB NUM1 - NUM2.
Step 7- Display SUB.
Step 8-Do Division of numbers and store it in third variable i.e. DIV.
ADD NUM1 / NUM2.
Step 9- Display DIV.
Step 10- Do multiplication of numbers and store it in third variable i.e. MUL.
MUL NUM1 * NUM2.
Step 11- Display MUL.
Step 12- Stop
Algorithm for finding greatest number from given 2
numbers
Algorithm Name-Finding Greatest number.
Input- NUM1 , NUM2.
Output- Display Greatest Number.
Step 1- Start
Step 2- Declare variable NUM1 ,NUM2
Step 3- Read values of NUM1 ,NUM2
Step 4- if NUM1 > NUM2
Display NUM1 is greater.
else,
Display NUM2 is greater.
Step 5- Stop
Sanjivani K. B. P. Polytechnic, Kopargaon Department of Computer Technology Prof. Vaibhav A. Parjane

Examples of Algorithms : Introduction to C.pptx

  • 1.
    SANJIVANI K. B.P. POLYTECHNIC, KOPARGAON With NBA ACCREDIATED programs , Approved by AICTE, New Delhi, Recognized by Govt. of Maharashtra, Affiliated to Maharashtra State Board of Technical Education, Mumbai, ISO 9001:2015 Certified Institute Department:- Computer Technology Class:- CM2I Name of Subject:- Programming in C MSBTE Subject Code:- 22226 Name of Faculty: Prof. Vaibhav A. Parjane 1
  • 2.
    Topic to beCovered Examples of algorithms Sanjivani K. B. P. Polytechnic, Kopargaon Department of Computer Technology Prof. Vaibhav A. Parjane 2
  • 3.
    Algorithm for MakingTea Algorithm Name-Making Tea Input- Water, Tea Leaves, Sugar, Gas, Stove, Utensil, Milk, cup. Output- Tea Step 1- Start Step 2- Light gas. Step 3- Boil Water in utensil, put tea leaves and sugar in it. Step 4- After Boiling it properly put milk in it. Step 5- After boiling it properly serve it in Cup. Step 6- Stop Sanjivani K. B. P. Polytechnic, Kopargaon Department of Computer Technology Prof. Vaibhav A. Parjane
  • 4.
    4 Sanjivani K. B.P. Polytechnic, Kopargaon Department of Computer Technology Prof. Vaibhav A. Parjane
  • 5.
    5 Sanjivani K. B.P. Polytechnic, Kopargaon Department of Computer Technology Prof. Vaibhav A. Parjane
  • 6.
    6 Sanjivani K. B.P. Polytechnic, Kopargaon Department of Computer Technology Prof. Vaibhav A.
  • 7.
    7 Sanjivani K. B.P. Polytechnic, Kopargaon Department of Computer Technology Prof. Vaibhav A. Parjane
  • 8.
    Algorithm for ArithmeticOperations Algorithm Name-Arithmetic Operations Input- Two Numbers Output- Addition, Substraction,Division,Multiplication of two Numbers. Step 1- Start Step 2- Declare variable NUM1,NUM2,ADD,SUB,DIV,MUL. Step 3- Read values of NUM1 and NUM 2. Step 4- Do addition of numbers and store it in third variable i.e. ADD. ADD NUM1+NUM2. Step 5- Display ADD. Step 6-Do Substraction of numbers and store it in third variable i.e. SUB. SUB NUM1 - NUM2. Step 7- Display SUB. Step 8-Do Division of numbers and store it in third variable i.e. DIV. ADD NUM1 / NUM2. Step 9- Display DIV. Step 10- Do multiplication of numbers and store it in third variable i.e. MUL. MUL NUM1 * NUM2. Step 11- Display MUL. Step 12- Stop
  • 9.
    Algorithm for findinggreatest number from given 2 numbers Algorithm Name-Finding Greatest number. Input- NUM1 , NUM2. Output- Display Greatest Number. Step 1- Start Step 2- Declare variable NUM1 ,NUM2 Step 3- Read values of NUM1 ,NUM2 Step 4- if NUM1 > NUM2 Display NUM1 is greater. else, Display NUM2 is greater. Step 5- Stop Sanjivani K. B. P. Polytechnic, Kopargaon Department of Computer Technology Prof. Vaibhav A. Parjane