Premium Essay

Exponent Calculator Programming Logic and Design

In: Computers and Technology

Submitted By Faythless121
Words 266
Pages 2
Purpose: Calculate the result of a number raised to the power of

another number input by the user using iterative logic without overflow of 32-bit integers##

//Program start//

START

//declare variables //

declare unsigned int base, exp, answer, errorInput, errorOutput

Declare var string exit

Global var constant int multiply = 1, maxValue = 2147483647

Set answer = 1

Set base = 1

Set exp = 1

// determine if input fits in unsigned 32 bit int and set exit sentinel //

//welcome message//

Display “This program will determine the value of an integer (X) raised to the power of a second integer (N).”

WHILE exit !=n

//set repeat of input if error message is flagged and reset error flags//

DO

SET errorInput = 0

Set errorOutput = 0

//user input prompts//

Display “Please Enter first integer: “

Input base

Display “Please enter second integer: ”

Input exp

IF (base,exp) >= maxValue THEN

//error message//

Display “ Error! Value exceeds maximum available input. Please enter a value less than 2147483647”

SET errorInput = 1

END IF

WHILE errorInput = 1

//perform calculation with iterative multiplication//

//check for error outputs & unneccessary execution of loop//

IF exp != 0 THEN

FOR (errorOutput ! =1 && multiply maxValue THEN

SET errorOutput = 1

END IF

END FOR

//end calculation and check for maximum value overflow in result//

END IF

ElSE IF exp = 0 THEN

Set answer = 1

END IF

IF errorOutput = 0 THEN

Display “The answer is: “, answer

ELSE IF errorOutput = 1 THEN

Display “ERROR: value of result exceeds maximum memory capability”

END IF

//exit sentinel confirmation//

Display “Would you like to calculate another? Please enter “y” for yes and “n” for no.”

INPUT exit

Similar Documents

Premium Essay

All About Computer

...------------------------------------------------- Who is the father of the computer? There are hundreds of people who have major contributions to the field of computing. The following sections detail the primary founding fathers of computing, the computer, and the personal computer we all know and use today. Father of computing Charles Babbage was considered to be the father of computing after his invention and concept of the Analytical Engine in 1837. The Analytical Engine contained an Arithmetic Logic Unit (ALU), basic flow control, and integrated memory; hailed as the first general-purpose computer concept. Unfortunately, because of funding issues this computer was never built while Charles Babbage was alive. However, in 1910 Henry Babbage, Charles Babbage's youngest son was able to complete a portion of the machine that could perform basic calculations. In 1991, the London Science Museum completed a working version of the Analytical Engine No 2. This version incorporated Babbage's refinements developed during the creation of the Analytical Engine. Although Babbage never completed his invention in his lifetime, his radical ideas and concepts of the computer are what make him the father of computing. Father of the computer There are several people who could be considered as the father of the computer including Alan Turing, John Atanasoff, and John von Neumann. However, for the purpose of this document we're going to be considering Konrad Zuse as the father of the...

Words: 6884 - Pages: 28

Premium Essay

Term Paper

...computers because they also use computers in order to finish their jobs more accurately, making them aware of the computer’s history. II. Body of the Document A. Evolution of Computer in the late 16th century, the 18th century, and the early 19th century: 1. “Abacus was the first counting device, which is originally made from Asia. It worked on a place-value notion meaning that the place of a bead or rock on the apparatus determined how much it was worth. During the 1660s, John Napier discovered logarithms. Robert Bissaker invented the slide rule which will remain in popular use until 19th century. During 1642, Blaise Pascal, a French mathematician and philosopher, invented the first mechanical digital calculator using gears, called the Pascaline. Although this machine could perform addition and subtraction on whole numbers, it was too expensive and only Pascal himself could repair it.” 2. “During 1804, Joseph Marie Jacquard used punch cards to...

Words: 14119 - Pages: 57

Premium Essay

Computer Science Illuminated

...learning styles and enhance the learning experience. Goin’ Live This step-by-step HTML Tutorial will guide you from start to finish as you create your own website. With each lesson, you’ll gain experience and confidence working in the HTML language. Online Glossary We’ve made all the key terms used in the text easily accessible to you in this searchable online glossary. The Learning Store Jones and Bartlett Publishers has a wealth of material available to supplement the learning and teaching experience. Students and instructors will find additional resources here or at http://computerscience. jbpub.com The Language Library Here you will find two complete chapters that supplement the book’s language-neutral approach to programming concepts. A JAVA language chapter and C++ language chapter are included and follow the same pedagogical approach as the textbook. http://csilluminated.jbpub.com eLearning Our eLearning center provides chapter-specific activities that will actively engage you in the learning process. Each activity directly correlates to material presented in the text to help you gain command over chapter content. Animated Flashcards Computer science is rich with vocabulary, and these virtual flashcards will help you quickly master new terms and definitions. Interactive Review You can check your general...

Words: 67693 - Pages: 271

Premium Essay

Heuy2Kj4

...Computer organization. 2. Computer architecture. I. Lobur, Julia. II. Title. QA76.9.C643 N85 2003 004.2’2—dc21 2002040576 All rights reserved. No part of the material protected by this copyright notice may be reproduced or utilized in any form, electronic or mechanical, including photocopying, recording, or any information storage or retrieval system, without written permission from the copyright owner. Chief Executive Officer: Clayton Jones Chief Operating Officer: Don W. Jones, Jr. Executive V.P. and Publisher: Robert W. Holland, Jr. V.P., Design and Production: Anne Spencer V.P., Manufacturing and Inventory Control: Therese Bräuer Director, Sales and Marketing: William Kane Editor-in-Chief, College: J. Michael Stranz Production Manager: Amy Rose Senior Marketing Manager: Nathan Schultz Associate Production Editor: Karen C. Ferreira Associate Editor: Theresa DiDonato Production Assistant: Jenny McIsaac Cover Design: Kristin E. Ohlin Composition: Northeast Compositors Text...

Words: 118595 - Pages: 475

Premium Essay

Hhello

...Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City São Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Vice President and Editorial Director, ECS: Editor-in-Chief: Editorial Assistant: Vice President, Marketing: Marketing Manager: Marketing Coordinator: Vice President, Production: Managing Editor: Production Project Manager: Manufacturing Buyer: Art Director: Cover Designer: Cover Image: Media Editor: Project Management: Composition and Illustration: Printer/Binder: Cover Printer: Marcia Horton Michael Hirsch Stephanie Sellinger Patrice Jones Yezan Alayan Kathryn Ferranti Vince O’Brien Jeff Holcomb Kayla Smith-Tarbox Lisa McDowell Linda Knowles Joyce Cosentino Wells/JWells Design © Digital Vision Dan Sandin/Wanda Rockwell Sherill Redd, Aptara®, Inc. Aptara®, Inc. Edwards Brothers LeHigh-Phoenix Color/Hagerstown Credits and acknowledgments borrowed from other sources and reproduced, with permission, appear on the Credits page in the endmatter of this textbook. Copyright © 2012, 2009 Pearson Education, Inc., publishing as Addison-Wesley. All rights reserved. Manufactured in the United States of America. This publication is protected by Copyright, and permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s) to...

Words: 76897 - Pages: 308

Premium Essay

Acer America

...Fourth Edition, last update November 01, 2007 2 Lessons In Electric Circuits, Volume IV – Digital By Tony R. Kuphaldt Fourth Edition, last update November 01, 2007 i c 2000-2010, Tony R. Kuphaldt This book is published under the terms and conditions of the Design Science License. These terms and conditions allow for free copying, distribution, and/or modification of this document by the general public. The full Design Science License text is included in the last chapter. As an open and collaboratively developed text, this book is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Design Science License for more details. Available in its entirety as part of the Open Book Project collection at: www.ibiblio.org/obp/electricCircuits PRINTING HISTORY • First Edition: Printed in June of 2000. Plain-ASCII illustrations for universal computer readability. • Second Edition: Printed in September of 2000. Illustrations reworked in standard graphic (eps and jpeg) format. Source files translated to Texinfo format for easy online and printed publication. • Third Edition: Printed in February 2001. Source files translated to SubML format. SubML is a simple markup language designed to easily convert to other markups like A LTEX, HTML, or DocBook using nothing but search-and-replace substitutions. • Fourth Edition: Printed in March 2002. Additions...

Words: 29763 - Pages: 120

Free Essay

Nit-Silchar B.Tech Syllabus

...Laboratory Workshop Physical Training-I NCC/NSO/NSS L 3 3 3 1 3 0 0 0 0 13 T 1 0 1 0 0 0 0 0 0 2 1 1 1 1 0 0 0 0 4 1 1 0 0 0 0 0 0 2 0 0 0 0 P 0 0 0 3 0 2 3 2 2 8 0 0 0 0 0 2 2 2 2 0 0 0 0 0 2 2 2 6 0 0 8 2 C 8 6 8 5 6 2 3 0 0 38 8 8 8 8 6 2 0 0 40 8 8 6 6 6 2 2 2 40 6 6 8 2 Course No EC-1101 CS-1101 MA-1102 ME-1101 PH-1101/ CH-1101 CS-1111 EE-1111 PH-1111/ CH-1111 Course Name Semester-2 Basic Electronics Introduction to Computing Mathematics-II Engineering Mechanics Physics/Chemistry Computing Laboratory Electrical Science Laboratory Physics/Chemistry Laboratory Physical Training –II NCC/NSO/NSS Semester-4 Structural Analysis-I Hydraulics Environmental Engg-I Structural Design-I Managerial Economics Engg. Geology Laboratory Hydraulics Laboratory Physical Training-IV NCC/NSO/NSS Semester-6 Structural Design-II Structural Analysis-III Foundation Engineering Transportation Engineering-II Hydrology &Flood Control Concrete Lab Structural Engineering Lab L 3 3 3 3 3 0 0 0 0 0 15 3 3 3 3 3 0 0 0 0 15 3 3 3 3 3 0 0 T 0 0 1 1 1 0 0 0 0 0 3 1 1 0 1 0 0 0 0 0 3 1 1 1 0 0 0 0 P 0 0 0 0 0 2 2 2 2 2 6 0 0 0 0 0 2 2 2 2 4 0 0 0 0 0 2 2 C 6 6 8 8 8 2 2 2 0 0 42 8 8 6 8 6 2 2 0 0 40 8 8 8 6 6 2 2 MA-1201 CE- 1201 CE -1202 CE -1203 CE-1204 CE-1211 Semester-3 Mathematics-III Building Materials and...

Words: 126345 - Pages: 506

Free Essay

Ds Java

...A Practical Introduction to Data Structures and Algorithm Analysis Third Edition (Java) Clifford A. Shaffer Department of Computer Science Virginia Tech Blacksburg, VA 24061 April 16, 2009 Copyright c 2008 by Clifford A. Shaffer. This document is the draft of a book to be published by Prentice Hall and may not be duplicated without the express written consent of either the author or a representative of the publisher. Contents Preface xiii I Preliminaries 1 1 Data Structures and Algorithms 1.1 A Philosophy of Data Structures 1.1.1 The Need for Data Structures 1.1.2 Costs and Benefits 1.2 Abstract Data Types and Data Structures 1.3 Design Patterns 1.3.1 Flyweight 1.3.2 Visitor 1.3.3 Composite 1.3.4 Strategy 1.4 Problems, Algorithms, and Programs 1.5 Further Reading 1.6 Exercises 3 4 4 6 8 12 13 14 15 16 17 19 21 2 Mathematical Preliminaries 2.1 Sets and Relations 2.2 Miscellaneous Notation 2.3 Logarithms 2.4 Summations and Recurrences 25 25 29 31 33 iii iv Contents 2.5 2.6 2.7 2.8 2.9 3 II 4 Recursion Mathematical Proof Techniques 2.6.1 Direct Proof 2.6.2 Proof by Contradiction 2.6.3 Proof by Mathematical Induction Estimating Further Reading Exercises Algorithm Analysis 3.1 Introduction 3.2 Best, Worst, and Average Cases 3.3 A Faster Computer, or a Faster Algorithm? 3.4 Asymptotic Analysis 3.4.1 Upper Bounds 3.4.2 Lower Bounds 3.4.3 Θ Notation 3.4.4 Simplifying...

Words: 30587 - Pages: 123

Free Essay

Student

...CONCEPTS OF PROGRAMMING LANGUAGES TENTH EDITION This page intentionally left blank CONCEPTS OF PROGRAMMING LANGUAGES TENTH EDITION R OB E RT W. S EB ES TA University of Colorado at Colorado Springs Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Vice President and Editorial Director, ECS: Marcia Horton Editor in Chief: Michael Hirsch Executive Editor: Matt Goldstein Editorial Assistant: Chelsea Kharakozova Vice President Marketing: Patrice Jones Marketing Manager: Yez Alayan Marketing Coordinator: Kathryn Ferranti Marketing Assistant: Emma Snider Vice President and Director of Production: Vince O’Brien Managing Editor: Jeff Holcomb Senior Production Project Manager: Marilyn Lloyd Manufacturing Manager: Nick Sklitsis Operations Specialist: Lisa McDowell Cover Designer: Anthony Gemmellaro Text Designer: Gillian Hall Cover Image: Mountain near Pisac, Peru; Photo by author Media Editor: Dan Sandin Full-Service Vendor: Laserwords Project Management: Gillian Hall Printer/Binder: Courier Westford Cover Printer: Lehigh-Phoenix Color This book was composed in InDesign. Basal font is Janson Text. Display font is ITC Franklin Gothic. Copyright © 2012, 2010, 2008, 2006, 2004 by Pearson Education, Inc., publishing as Addison-Wesley. All rights reserved. Manufactured...

Words: 142312 - Pages: 570

Free Essay

Concepts of Programming Languages

...CONCEPTS OF PROGRAMMING LANGUAGES TENTH EDITION This page intentionally left blank CONCEPTS OF PROGRAMMING LANGUAGES TENTH EDITION R O B E RT W. S EB ES TA University of Colorado at Colorado Springs Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Vice President and Editorial Director, ECS: Marcia Horton Editor in Chief: Michael Hirsch Executive Editor: Matt Goldstein Editorial Assistant: Chelsea Kharakozova Vice President Marketing: Patrice Jones Marketing Manager: Yez Alayan Marketing Coordinator: Kathryn Ferranti Marketing Assistant: Emma Snider Vice President and Director of Production: Vince O’Brien Managing Editor: Jeff Holcomb Senior Production Project Manager: Marilyn Lloyd Manufacturing Manager: Nick Sklitsis Operations Specialist: Lisa McDowell Cover Designer: Anthony Gemmellaro Text Designer: Gillian Hall Cover Image: Mountain near Pisac, Peru; Photo by author Media Editor: Dan Sandin Full-Service Vendor: Laserwords Project Management: Gillian Hall Printer/Binder: Courier Westford Cover Printer: Lehigh-Phoenix Color This book was composed in InDesign. Basal font is Janson Text. Display font is ITC Franklin Gothic. Copyright © 2012, 2010, 2008, 2006, 2004 by Pearson Education, Inc., publishing as Addison-Wesley. All rights reserved. Manufactured in the United States...

Words: 142253 - Pages: 570

Free Essay

Maglev

...*3963103* [3963] – 103 T.E. (Petroleum) (Semester – I) Examination, 2011 DRILLING & PRODUCTION OPERATIONS (2003 Course) Time : 3 Hours Max. Marks : 100 Instructions : 1) Question Nos. 1 and 5 are compulsory. Out of the remaining attempt 2 questions from Section I and 2 questions from Section II. 2) Answers to the two Sections should be written in separate books. 3) Neat diagrams must be drawn wherever necessary. 4) Black figures to the right indicate full marks. 5) Use of Logarithmic Tables, Slide Rule, Mollier Charts, Electronic Pocket Calculator and Steam Tables is allowed. 6) Assume suitable data, if necessary. SECTION – I 1. What are different systems on a drilling rig ? Explain any one in detail with suitable diagramme. 18 2. a) Calculate Bottom hole pressure if well depth is 2500 m and mud weight is 1.2 gm/cc. b) Calculate mud weight if mud gradient is 0.87 psi/ft. ′ c) Calculate volume bbl/meter for drill pipe O.D. = 5′ inch and I.D. = 4.276 inch. 2 2 2 10 8 8 16 d) Draw circulation system on a drilling rig. 3. a) Discuss IADC classification of a bit in details. b) Discuss different factors affecting rate of penetration in details. 4. Write short note on : i) Coring ii) Fishing tools iii) BOP iv) Directional well P.T.O. [3963] – 103 -2- *3963103* SECTION – II 5. a) Discuss different types of casings and function of the casings in brief. b) Discuss different types of well completion techniques. 6. a) Discuss primary cementation process with...

Words: 172166 - Pages: 689

Premium Essay

Analysis

...SEVENTH EDITION PROBLEM SOLVING AND PROGRAM DESIGN in C This page intentionally left blank SEVENTH EDITION PROBLEM SOLVING AND PROGRAM DESIGN in C Jeri R. Hanly, University of Wyoming Elliot B. Koffman, Temple University Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Editorial Director, ECS: Marcia Horton Editor-in-Chief: Michael Hirsch Senior Project Manager: Carole Snyder Director of Marketing: Patrice Jones Marketing Manager: Yezan Alayan Senior Marketing Coordinator: Kathryn Ferranti Director of Production: Vince O’Brien Managing Editor: Jeff Holcomb Associate Managing Editor: Robert Engelhardt Production Manager: Pat Brown Creative Director: Jayne Conte Designer: Suzanne Behnke Media Editor: Daniel Sandin Media Project Manager: John Cassar Cover Image: (c) michael Holcomb/Shutterstock.com Full-Service Project Management: Mohinder Singh/ Aptara®, Inc. Composition: Aptara®, Inc. Printer/Binder: Edwards Brothers Cover Printer: Lehigh-Phoenix Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear on appropriate page within text. Photo Credits: Page 4: Fig. 0.1: akg-images/Paul Almasy/Newscom. Page 11: Fig. 0.4: © 2008 IEEE/Journal of Microelectromechanical Systems (2006). Page 15:...

Words: 158087 - Pages: 633

Free Essay

Integrated Circuits

...number of the book's printing. For example, a printing code of 92-23 shows that the twenty-third printing of the book occurred in 1992. Printed in the United States of America. Preface I don't like to revise books. Correct, yes. Revise, no. So I won't. A book becomes history the instant it appears in print. To tamper with history messes with what others and I were thinking at the time and distorts the way things were, forcing new contexts. With the TTL Cookbook, it is now January 1982, and this book is eight years old. It is also one of the best selling technical paperback classics of all time. And looking around, both nothing has changed and everything has changed. ITL is still the largest and most popular general purpose logic family, although it now shares the spotlight with an only somewhat...

Words: 89774 - Pages: 360

Free Essay

Technology

...VOCATIONAL HIGHER SECONDARY TEACHER’S SOURCE BOOK COMPUTER SCIENCE FIRST YEAR Government of Kerala Department of Education SCERT - 2005-06 STATE COUNCIL OF EDUCATIONAL RESEARCH AND TRAINING Vidyabhavan, Poojappura, Thiruvananthapuram-12 Prepared by: State Council of Educational Research & Training (SCERT) Vidyabhavan, Poojappura, Thiruvananthapuram -12 Kerala E-mail:scertkerala@asianetindia.com Type setting by: SCERT Computer Lab. © Government of Kerala Education Department 2005 P REFACE Dear Teachers, Computer Science is concerned with the gathering, manipulation, classification, storage and retrival of knowledge. Understanding Computer Science, is necessary because of its power and influence in modern society. Learning of Computer Science should be activity based, process oriented, student-centred, environmental based and life oriented. The approach to learning is based on five domains of science: Knowledge domain, process domain, application and connection domain, domain of attitudes and values and creativity domain. But we know that most of the present vocational higher secondary teachers are not familiar with this paradigm. Hence for the first time we are introducing sourcebooks for all the subjects in the vocational higher secondary curriculum. This source book for computer science aims to provide guidelines to the teachers of our state to change their pedagogy from the conventional content-based approach to the process...

Words: 27034 - Pages: 109

Premium Essay

Cd Key

...Java Quick Reference Console Input Scanner input = new Scanner(System.in); int intValue = input.nextInt(); long longValue = input.nextLong(); double doubleValue = input.nextDouble(); float floatValue = input.nextFloat(); String string = input.next(); Console Output System.out.println(anyValue); JOptionPane.showMessageDialog(null, "Enter input"); GUI Input Dialog String string = JOptionPane.showInputDialog( "Enter input"); int intValue = Integer.parseInt(string); double doubleValue = Double.parseDouble(string); Message Dialog Primitive Data Types byte short int long float double char boolean 8 bits 16 bits 32 bits 64 bits 32 bits 64 bits 16 bits true/false Arithmetic Operators + * / % ++var --var var++ var-addition subtraction multiplication division remainder preincrement predecrement postincrement postdecrement Assignment Operators = += -= *= /= %= assignment addition assignment subtraction assignment multiplication assignment division assignment remainder assignment Relational Operators < >= == != less than less than or equal to greater than greater than or equal to equal to not equal Logical Operators && || ! ^ short circuit AND short circuit OR NOT exclusive OR if Statements if (condition) { statements; } if (condition) { statements; } else { statements; } if (condition1) { statements; } else if (condition2) { statements; } else { statements; } switch Statements switch (intExpression) { case value1: statements; break; ... case valuen: statements; break;...

Words: 73366 - Pages: 294