Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
thumb_up100%
3.
a. Write a for loop that prints the ASCII code of each character in a string
named S. Usethe built-in function ord(character) to convert each
character to an ASCII integer.
b. Next, change your loop to compute the sum of the ASCII codes of all
characters in a string
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- 5. Write a python code with a loop that calculates the (float) sum of the following series of numbers: A single loop.arrow_forwardI need help writing a java code that counts vowel in a sentence MUST use while looparrow_forwardProgram - Python Write a program asking the user to keep entering in strings (ie names) until they enter the string “leave”, at which point you’ll exit the loop and tell them how many times they entered the string “gold”. This one requires that you use a loop and also keep a tally of the number of times they enter the string gold.arrow_forward
- Write a for loop that will print the lower case letters of the alphabet backwards. Do not use ASCII codes.arrow_forward1. Here is a program that simply reads characters from the keyboard until the user hits the enter (or return) key. Add code to the program so that it allows the user to enter up to a 32-bit integer in hexadecimal and converts the number to int format. Your algorithm should make use of the masking operation described above. The program should display the int in both hexadecimal and decimal format for the user. Assume that the user will not make mistakes. /* readHex.c * Asks user to enter a number in hexadecimal. * INCOMPLETE PROGRAM FOR EXERCISE. * 2017-09-29: Bob Plantz $/ #include #include int main(void) { int x; unsigned char aChar; printf("Enter an integer in hexadecimal: "); fflush(stdout); x = 0; read (STDIN_FILENO, &aChar, 1); while (aChar != '\n') { read (STDIN_FILENO, &aChar, 1); } // initialize result // get first character. // look for return key printf("You entered %#010x = %d (decimal)\n\n", x, x); return 0;arrow_forwarduse C++ In this program you will be outputting the characters that map to the ASCII codes 32 through 126. You will need a loop to iterate through the input values and output the corresponding character. This mapping is shown in appendix A in your Gaddis text book. Your program will be reading in two unsigned integer values. The prompt for read will be: Enter lower and upper values You need to check that both values are in the range of 32 to 126. If the values are less than 32 or greater than 126 you need to display the message: Values must be in range 32 to 126 inclusive You will also display the above message if the first value read in is larger than the second value. If the values are invalid you need to reread the values with the prompt. Enter lower and upper values You need to keep reading in values, checking if they are valid and displaying an error message until the values read in are valid. You can use a while or do while loop to do this. Once you have valid input values you…arrow_forward
- Using for loop, write a program that accepts an integer from the user between 100 and 1000 andchecks if it is divisible by 2, 3, 4, 5, 6, 7, 8, 9 and accordingly displays a message to the userarrow_forward12. Write a loop of the specified type that sums up the even integers between 1 and 21. a. a while loop b. a for looparrow_forwardplease help pleasearrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education