Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
79 views
9 pages
Algorithm Exercise
Computer Science with python
Uploaded by
Santosh Shrestha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save Algorithm Exercise For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
79 views
9 pages
Algorithm Exercise
Computer Science with python
Uploaded by
Santosh Shrestha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Algorithm Exercise For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save Algorithm Exercise For Later
You are on page 1
/ 9
Search
Fullscreen
Question 14: \Wte an algorithm to compute the sum of odd and even numbers up to. Answer, The algorithm as Step 1:Stort Step 2 Input N. Step 3 sume «0, Step 4 sumo =0. Step 5.ctr=1 (Create POF in your applications withthe Pufcrowd HTML to POF API ‘Step 6 while (tr (ctr med 2 =o) ‘sume = cume + tr ee ume + ett ‘Step 7: Print‘sum of even nurberis* sume. Step 8 Print ‘sum of odd number is’ surra, Step 9. EndQuestion 1 ©xplain Algorithm Anewer: [An algorithm is a step by step instructions required to solve any problem, These instructions are in user's language that means they are independent of any programming language. 3 Question 2: write some properties of algorithm. isis FOF woul apenas Paw S PO AB En Ansvrer: ‘Some properties of algorithm are 1. An algotithrn should terminate after finite number of steps. 2. An algorithm should be simple so that anyone can understand them property 3. An algorithm should be universal and lead to an unique solution of the problem 4 An algorithm should have capebilty to handle some unexpected situations which may arise during the solution of a particular problem. 5. An algorithm should be able to soive all problems of a particular type for which it is designed. [Any 3,1 mark for each correct point]Question 3: Write some characteristics of algorithm Answer: ‘Some characteristics of aigorithn are 1. Each and every instruction should be short and clear. 2 Each instruction should be such that it can be performed ina finite time. 3. One oF mare instructions should not be repeated infinitely 4, After performing the instructions the desired result must be cbtained. (Any 3,1 mark for each correct point] Question 4: Write an algorithm to calculate sum of two numbers, Answer: Create POF in your applications with the Pdfcrowd HTML to POF API Step 1 Start Step 2: Read AB. ‘Step 3: Sum=A+B. Step 4 Print Sum step 5: Stop‘Question §: Write an algorithm to calculate simple interest. Answer: Step 1: Start Step 2: Read RRT, Step 3 :Si=(PARITY/100. Step 4: Print SI Step 5: Stop. 8 Question 6: \Write an algorithm to convert temperature ftom Fahrenhett to Celsius. Anewer: Step 1: Start Step 2: Read F Step 3: C=(S(F-32))/9. Step 4: Print C Step 5: Stop.Question 7: \rite an algorthm to caleulste area of iangla Answer: Step 1 Star. Step 2:Read abe. step 2 s=(arbsc}/2 Step 4: Area = ele-al(oa}e-c) Step 5:Print Area step 6:Siop.®Question & Write an algorithen thet generates the fibbonacc! series 2s 11.28, 5.0.N tems, Answer, The algorithm as Step 1 Begin Step 2: Read N. step 3: Let a Step 5: otr= 2, siepo:c=a+b, Step 7:a=b. step 8:b Step 9° etr= ctr +1 1 Step 4. Printa b. Create PDF in your applcatons with the Pdicrowd HTL io PDF AP) Step 10: If cte
¥ continue step 8, Step 3: If Y>Z thea print’Y is the largest ‘and continue step 7 Step 4 Continue step 6 Step 5: 11> then print ‘Xis the largest “and continue step 7, Step 6: Prit'Zistaroest’ Step T-En#.”Question 12, \irte an algorthm to print the bigaer of any two unique given numbers Answer: The algorithm as Step 1 Read two numbers A and 8 Step 2:Compare A and 8 Step 3:if Ais creater than B then, print A else print 8 Step 4: Stop. Create PDF in your appications with the Pdfcrowd HTML to PDF AP) Question 13: \inte an algorthm to inaut N numbers ardifing the largest among them Answer: The algoritamas Step 1 Read N Step 2: Letotr= 1 Step 3: Read Num. Step 4 large = Num, Step 5: Read next Num. Step 6:08 = ety 47 Step 7: (Num > large) then lage ‘Step 8: if (ctr<=N) then repeat steps 5 and 6 Step 9: Print large Step 10: End
You might also like
Exam Review 2 Q & A Sam
PDF
0% (1)
Exam Review 2 Q & A Sam
5 pages
Skip To Main Content
PDF
No ratings yet
Skip To Main Content
6 pages
Dual Methods For The Minimization of The Total Variation
PDF
No ratings yet
Dual Methods For The Minimization of The Total Variation
30 pages
Ah Formulae
PDF
No ratings yet
Ah Formulae
5 pages
Data Structures & Algorithms LAB - Spring 2014 (BS-CS-F12 Morning & Afternoon)
PDF
100% (2)
Data Structures & Algorithms LAB - Spring 2014 (BS-CS-F12 Morning & Afternoon)
3 pages
Curs 0 Introducere in Matlab
PDF
No ratings yet
Curs 0 Introducere in Matlab
73 pages
MatlabGetStart Course
PDF
No ratings yet
MatlabGetStart Course
32 pages
Machine Learning Handbook - Radivojac and White
PDF
No ratings yet
Machine Learning Handbook - Radivojac and White
108 pages
Pseudocode Example Slides
PDF
No ratings yet
Pseudocode Example Slides
16 pages
Arithmetic Coding
PDF
No ratings yet
Arithmetic Coding
12 pages
Asymptotes, Holes, and Graphing Rational Functions
PDF
No ratings yet
Asymptotes, Holes, and Graphing Rational Functions
4 pages
Algorithmics PDF
PDF
No ratings yet
Algorithmics PDF
119 pages
Introduction To Scilab
PDF
No ratings yet
Introduction To Scilab
23 pages
Algebra Formula
PDF
No ratings yet
Algebra Formula
1 page
Introduction To Programming Using C Language Lesson - 1 Output - Input Functions
PDF
No ratings yet
Introduction To Programming Using C Language Lesson - 1 Output - Input Functions
265 pages
Cubic Splines
PDF
No ratings yet
Cubic Splines
6 pages
An Introduction To An Introduction To Optimization Optimization Using Using Evolutionary Algorithms Evolutionary Algorithms
PDF
No ratings yet
An Introduction To An Introduction To Optimization Optimization Using Using Evolutionary Algorithms Evolutionary Algorithms
45 pages
Logic Gates PDF
PDF
No ratings yet
Logic Gates PDF
4 pages
Linear Algebra For Dummies Cheat Sheet
PDF
No ratings yet
Linear Algebra For Dummies Cheat Sheet
6 pages
Introduction To Programming Using Java
PDF
No ratings yet
Introduction To Programming Using Java
510 pages
Junior/Intermediate Number Theory Tips: A B A B
PDF
No ratings yet
Junior/Intermediate Number Theory Tips: A B A B
9 pages
JAVA Lab Practices
PDF
No ratings yet
JAVA Lab Practices
7 pages
Feedback Control Problems Using Matlab and The Control System Toolbox PDF
PDF
No ratings yet
Feedback Control Problems Using Matlab and The Control System Toolbox PDF
2 pages
Maths Terms
PDF
No ratings yet
Maths Terms
52 pages
Artificial Neural Networks: Classification Using Multilayer Perceptron Model
PDF
No ratings yet
Artificial Neural Networks: Classification Using Multilayer Perceptron Model
15 pages
Latex Presentation
PDF
No ratings yet
Latex Presentation
16 pages
Matlab Manual
PDF
No ratings yet
Matlab Manual
70 pages
BCA 103 - Mathematical Foundation of Computer SC - BCA
PDF
100% (2)
BCA 103 - Mathematical Foundation of Computer SC - BCA
274 pages
Python Programs
PDF
No ratings yet
Python Programs
12 pages
Latex Math Cheatsheet 2018-01-13
PDF
No ratings yet
Latex Math Cheatsheet 2018-01-13
1 page
Mathematics Honours Regular
PDF
No ratings yet
Mathematics Honours Regular
44 pages
CpyProbStatSection PDF
PDF
No ratings yet
CpyProbStatSection PDF
240 pages
Evolutionary Programming
PDF
No ratings yet
Evolutionary Programming
19 pages
NFA To DFA Conversion
PDF
No ratings yet
NFA To DFA Conversion
10 pages
Chris McMullen - Essential Calculus-Based Physics Study Guide Workbook - The Laws of Motion Copie 3
PDF
No ratings yet
Chris McMullen - Essential Calculus-Based Physics Study Guide Workbook - The Laws of Motion Copie 3
1 page
Mathematical Modeling
PDF
No ratings yet
Mathematical Modeling
8 pages
Number System
PDF
No ratings yet
Number System
8 pages
Sample Lab Work For Ms Word
PDF
No ratings yet
Sample Lab Work For Ms Word
40 pages
Gauss Jacobi and Gauss Seidal
PDF
No ratings yet
Gauss Jacobi and Gauss Seidal
23 pages
Tutorials in Introductory Physics (Physics Education Research User S Guide)
PDF
No ratings yet
Tutorials in Introductory Physics (Physics Education Research User S Guide)
9 pages
Big O PDF
PDF
No ratings yet
Big O PDF
11 pages
Tutorial Linked List
PDF
No ratings yet
Tutorial Linked List
7 pages
C Programming
PDF
No ratings yet
C Programming
28 pages
Project List
PDF
No ratings yet
Project List
40 pages
Computer Arithmetic Practice Exercises Programming
PDF
No ratings yet
Computer Arithmetic Practice Exercises Programming
213 pages
String Handling in C++
PDF
No ratings yet
String Handling in C++
6 pages
Deterministic Finite Automata (DFA)
PDF
No ratings yet
Deterministic Finite Automata (DFA)
19 pages
Cheat Sheet
PDF
No ratings yet
Cheat Sheet
2 pages
PL SQL
PDF
No ratings yet
PL SQL
35 pages
Amc10 2019
PDF
No ratings yet
Amc10 2019
10 pages
Tutorials in Probability
PDF
No ratings yet
Tutorials in Probability
493 pages
Einstein College of Engineering: Sir.C.V.Raman Nagar, Tirunelveli-12
PDF
No ratings yet
Einstein College of Engineering: Sir.C.V.Raman Nagar, Tirunelveli-12
158 pages
Introduction To MATLAB For Engineers, Third Edition: An Overview of MATLAB
PDF
No ratings yet
Introduction To MATLAB For Engineers, Third Edition: An Overview of MATLAB
47 pages
Rsa - TCR PDF
PDF
No ratings yet
Rsa - TCR PDF
89 pages
Ordinary Differential Equations
PDF
No ratings yet
Ordinary Differential Equations
317 pages
Algorithms
PDF
No ratings yet
Algorithms
9 pages
Ilovepdf Merged
PDF
No ratings yet
Ilovepdf Merged
18 pages
Diwali Assignment Unit-1 20BAI10214
PDF
No ratings yet
Diwali Assignment Unit-1 20BAI10214
9 pages
TD 077
PDF
No ratings yet
TD 077
3 pages
CSCN 110 Chapter 2 - Student
PDF
No ratings yet
CSCN 110 Chapter 2 - Student
43 pages