Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
11th Edition
ISBN: 9780134743356
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 5, Problem 5.3E
Explanation of Solution
Given statements:
//iterate "i" until it reaches 1
for (i = 19; i >= 1; i+= 2) {//Line 1
//display the "i"
System.out.println(i); //Line 2
}//Line 3
Error in the statement:
Error #1:
Here, the “for” statem...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Urgent help needed!#!
6.Coding-----""Euler's totient function, also known as phi-function ϕ(n),counts the number of integers between 1 and n inclusive,which are coprime to n.(Two numbers are coprime if their greatest common divisor (GCD) equals 1)."""def euler_totient(n): """Euler's totient function or Phi function. Time Complexity: O(sqrt(n)).""" result = n for i in range(2, int(n ** 0.5) + 1): if n % i == 0: while n % i == 0: n //= i.
Computer Science
This is an introductory exercise to the manipulation of random variables with Python as a language
for scientific computing and numerical computation.
You have:
f(x) = Ae-0.1x)° 4
x*, 0
Chapter 5 Solutions
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Ch. 5 - Fill in the blanks in each of the following...Ch. 5 - Fill in the blanks in each of the following...Ch. 5 - Fill in the blanks in each of the following...Ch. 5 - Fill in the blanks in each of the following...Ch. 5 - Fill in the blanks in each of the following...Ch. 5 - Prob. 1.6SRECh. 5 - Prob. 1.7SRECh. 5 - State whether each of the following is true or...Ch. 5 - State whether each of the following is true or...Ch. 5 - State whether each of the following is true or...
Ch. 5 - State whether each of the following is true or...Ch. 5 - Prob. 2.5SRECh. 5 - State whether each of the following is true or...Ch. 5 - Prob. 2.7SRECh. 5 - Prob. 3.1SRECh. 5 - Prob. 3.2SRECh. 5 - Write a Java statement or a set of Java statements...Ch. 5 - Prob. 3.4SRECh. 5 - Find the error in each of the following code...Ch. 5 - Find the error in each of the following code...Ch. 5 - Find the error in each of the following code...Ch. 5 - Find the error in each of the following code...Ch. 5 - Describe the four basic elements of...Ch. 5 - Compare and contrast the while and for iteration...Ch. 5 - Prob. 3.1ECh. 5 - Compare and contrast the break and continue...Ch. 5 - Find and correct the error(s) in each of the...Ch. 5 - The following code should print whether integer...Ch. 5 - Prob. 5.3ECh. 5 - Find and correct the error(s) in each of the...Ch. 5 - What does the following program do? 1 // Exercise...Ch. 5 - (Find the Smallest Value) Write an application...Ch. 5 - (Calculating the Product of Odd Integers) Write an...Ch. 5 - (Factorials) Factorials are used frequently in...Ch. 5 - (Modified Compound-Interest Program) Modify the...Ch. 5 - (Triangle Printing Program) Write an application...Ch. 5 - (Bar-Chart Printing Program) One interesting...Ch. 5 - (Calculating Sales) An online retailer sells five...Ch. 5 - (Modified Compound-Interest Program) Modify the...Ch. 5 - Assume that i = 1, j = 2, k = 3 and m = 2. What...Ch. 5 - (Calculating the Value of ) Calculate the value of...Ch. 5 - (Pythagorean Triples) A right triangle can have...Ch. 5 - (Modified Triangle-Printing Program) Modify...Ch. 5 - (De Morgans Laws) In this chapter, we discussed...Ch. 5 - (Diamond-Printing Program) Write an application...Ch. 5 - Prob. 21.1ECh. 5 - A criticism of the break statement and the...Ch. 5 - What does the following program segment do? 1 for...Ch. 5 - Describe in general how youd remove any continue...Ch. 5 - Prob. 25.1E
Knowledge Booster
Similar questions
- When you perform arithmetic operations with operands of different types, such as adding an int and a float, ____________. C# chooses a unifying type for the result you must choose a unifying type for the result you must provide a cast you receive an error messagearrow_forward(Numerical) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters to 0, and then generate a large number of pseudorandom integers between 0 and 9. Each time a 0 occurs, increment the variable you have designated as the zero counter; when a 1 occurs, increment the counter variable that’s keeping count of the 1s that occur; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of the time they occurred.arrow_forwardChange this code into a program that receives a number and prints its divisors.( C language) #include <stdio.h> int main() { unsigned guess; /* current guess for prime */ unsigned factor; /* possible factor of guess */ unsigned limit; /* find primes up to this value */ printf("Find primes up to: "); scanf("%u", &limit); printf("2\n"); /* treat first two primes as special case */ printf("3\n"); guess = 5; /* initial guess */ while ( guess <= limit ) { /* look for a factor of guess */ factor = 3; while ( factor*factor < guess && guess % factor != 0 ) factor += 2;if ( guess % factor != 0 ) printf("%d\n", guess); guess += 2; /* only look at odd numbers */ } return 0; }arrow_forward
- We rite a recursive function that calculates the products of natural numbers (1 through n) as follows: - asks the user to enter a positive number n - calculates and prints out the product of 1 through n (for example for n=5 the product is 120) Uploads: .c code and the outputarrow_forward#include <stdio.h> int main(){printf(" enter two integers and ill add them \n"); int integer1;int integer2; scanf("%d,%d",&integer1, &integer2); int sum;sum = integer1+integer2; printf("sum is %d\n", sum); return 0; } when i run this code the sum is incorrect like when i type in 44 55 it says the sum is 109. whats wrong with the code?arrow_forwardCFG: Example 1 • Draw the CFG for the following code: int f(int n){ } int m = n* n; if (n < 0) else return 0; return m;arrow_forward
- #include using namespace std; int main() 3 { int x,y; or (x=0; x 3) break; cout << y << endl; }}} O O 10 O 5 04arrow_forwardFind the error in the following code and explain how to fix it: #include int main(void) { int *ptr; int m 1003; ptr = m; printf("%d",*ptr); } %3Darrow_forward1) Find the errors in the following codes: int main() { } int { Hanging Indent #include ; int a = 1;b = 4; c, d C + = a++; d = 5--; printf("Please enter an inter: "); scanf("%f", num) d = (num = 0? a+b:a+b+c); sum= (a:b:c:d: a+b+c+d); printf("Sum is %d: \n", Sum); Return 0;arrow_forward
- Use cin to read integers from input until 100 is read. For each remaining integer read before 100, if the integer is equal to 18, output "Value appears" followed by a newline and increment numOccurrences. Ex: If the input is 18 -2 18 18 100, then the output is: Value appears Value appears Value appears 3 time(s) 1 #include 2 using namespace std; 3 4 int main() { 5 6 7 8 9 10 11 12 13} int inputNumber; int numOccurrences; /* Your code goes here */ cout << numOccurrences << " time(s)" << endl; return 0;arrow_forwardb) Find the errors and correct them: 1) int sum-0;x; do{ cin<arrow_forwardc# console programingarrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr