
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
Concept explainers
Question
thumb_up100%

Transcribed Image Text:Problem
Ask the user for a positive integer N, then output the number of even and odd digits of N. The program
should continuously ask input from the user until the user inputs a nonpositive integer (where the
program must exit).
Sample Run
Enter n: 100
Even digits: 2
Odd digits: 1
Enter n: 31
Even digits: 0
Odd digits: 2
Enter n: 4286
Even digits: 4
Odd digits: 0
Enter n: 1234567890
Even digits: 5
Odd digits: 5
Enter n: -15
Goodbye!
NOTE: You are not allowed to use string functions/operations, lists, tuples, dictionaries, or any
other non-scalar objects.
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 3 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
- stop = int (input ( ) ) result = 0 for n in range (10): result += n * 2 if result > stop: break print (n) print (result) Input 8 Outputarrow_forwardWrite a code which take integer from user and reverse the number using while loop (Number could contain n no of digits). Example: Input: 2548 Output: 845arrow_forwardusing iostream domain and for looparrow_forward
- Read n numbers then check whether the number 17 within the numbers that 3 you have read. If it is not there then print "Not Found" else print "Found X Times".arrow_forwardCreate a program that will accept a number that will be the basis of the number of times a user can input different numeric values. The user will then input numbers based on the initial input. Identify the sum/total of all numbers but segregating the total for ODD and EVEN. Display the sum of both ODD and EVEN. Sample output: Please enter the count of input: 5 Please input No.1: 3 Please input No.2: 2 Please input No.3: 10 Please input No.4: 7 Please input No.5: 1 The total no of ODD is 3 and the sum is 11. The total no of EVEN is 2 and the sum 12. Using Matlab. Thanks!arrow_forward// * // Identify the incorrect code by line number (i.e. 1, 6). Enter one line number in each answer box. // This code snippet is from a program where a PIC24 uC in Master mode communicates with a // Maxim DS1722 Digital Thermometer // ********* 1.void writeConfigDS1722(uint8_t u8_i) { //assert chipselect //config address 2. SLAVE_DISABLE(); 3. ioMasterSPI1(0x80); 4. ioMasterSPI1(u8_i); //config value 5. SLAVE_ENABLE(); 6.}arrow_forward
- integer userAge // Program will be tested with 25, 20, 21, and 22 userAge = Get next input if userAge > 21 Put "greater than 21\n" to output // Your solution goes here Put "userAge: " to output Put userAge to output.arrow_forwardUse cin to read integer leftoverValue from input. Then, read the remaining integers from input until 99 is read. For each remaining integer read before 99, if the integer is positive, output the positive integer followed by a newline and subtract the positive integer from leftoverValue. Ex: If the input is: 57 -25 24 20 99 then the output is: 24 20 The total after subtracting all positive values is 13 Note: leftoverValue may go negative. 1 #include 2 using namespace std; 3 4 int main() { 5 6 7 8 9 10 11 12 13} int inputData; int leftoverValue; *Your code goes here */ cout << "The total after subtracting all positive values is " << leftoverValue << endl; return 0;arrow_forwardUsing 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_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