Computer Science: A Structured Programming Approach Using C, Third Edition
3rd Edition
ISBN: 9780534491321
Author: Behrouz A. Forouzan, Richard F. Gilberg
Publisher: Course Technology, Inc.
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 4, Problem 30PS
Write a
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Programming language: JAVA
Write a piece of code to generate 100 random characters (10 rows of 10 characters) and display them on the screen.
-In a loop, generate a random number between 1 to 255 by using Math.random(). Use this number as an ASCII code for a character char c and then print c.
Using python, please explain
1: A positive integer greater than 1 is said to be prime if it has no divisors other than 1 and itself. A positive integer greater than 1 is composite if it is not prime. Write a program that asks the user to enter an integer greater than 1, then displays all of the prime numbers that are less than or equal to the number entered
The program should work as follows:
Once the user has entered a number, the program should populate a list with all of the integers from 2 up through the value entered.
The program should then use a loop to step through the list. The loop should pass each element to a function that displays the element whether it is a prime number.
/*code
Kth Largest Factor
A positive integer d is said to be a factor of another positive integer N if when N is divided by d, the remainder obtained is zero. For example, for number 12, there are 6 factors 1, 2, 3, 4, 6, 12. Every positive integer k has at least two factors, 1 and the number k itself.Given two positive integers N and k, write a program to print the kth largest factor of N.
Input Format: The input is a comma-separated list of positive integer pairs (N, k).
Output Format: The kth highest factor of N. If N does not have k factors, the output should be 1.
Constraints:
1<N<10000000000
1<k<600.
You can assume that N will have no prime factors which are larger than 13..
Chapter 4 Solutions
Computer Science: A Structured Programming Approach Using C, Third Edition
Ch. 4 - Prob. 1PSCh. 4 - The function definition contains the code for a...Ch. 4 - Function calls that return void may not be used as...Ch. 4 - The address operator (&) is used to tell the...Ch. 4 - Variables defined within a block have global...Ch. 4 - Prob. 6PSCh. 4 - Which of the following statements about function...Ch. 4 - Which of the following is not a part of a function...Ch. 4 - Which of the following statements about function...Ch. 4 - Which of the following statements about local...
Ch. 4 - Prob. 11PSCh. 4 - Prob. 12PSCh. 4 - Which of the following statements will generate a...Ch. 4 - Which of the following statements about structure...Ch. 4 - Find any errors in the following function...Ch. 4 - Find any errors in the following function...Ch. 4 - Find any errors in the following function...Ch. 4 - Find any errors in the following function...Ch. 4 - Find any errors in the following function...Ch. 4 - Find any errors in the following function calls:...Ch. 4 - Evaluate the value of the following expressions:...Ch. 4 - Evaluate the value of the following...Ch. 4 - Prob. 23PSCh. 4 - Define the range of the random numbers generated...Ch. 4 - What would be printed from Program 4-17 when run...Ch. 4 - Prob. 26PSCh. 4 - Prob. 27PSCh. 4 - Prob. 28PSCh. 4 - Prob. 29PSCh. 4 - Write a program that generates a random number...Ch. 4 - Prob. 31PSCh. 4 - Code and run Program 4-16, "Top—down Development...Ch. 4 - Prob. 33PSCh. 4 - Prob. 34PSCh. 4 - Expand the calculator program, Program 4-15, to...Ch. 4 - Prob. 36PSCh. 4 - Write a function that receives a positive...Ch. 4 - Prob. 38PSCh. 4 - Prob. 39PSCh. 4 - Prepare a payroll earnings statement for the sales...Ch. 4 - Write a program that, given a beginning balance in...Ch. 4 - The formula for converting centigrade temperatures...Ch. 4 - Write a program that uses standard functions. The...Ch. 4 - Write a C program that creates customers' bills...
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
- Pythonarrow_forwardThe GCD (Greatest Common Divisor) of two numbers is the largest positive integer number that divides both the numbers without leaving any remainder. Write a program that prompts the user to enter two positive integers and computes their GCD. For example. GCD of 30 and 45 is 15. Sample Run 1: Enter two integers: 30 45 GCD of 30 and 45 is 15 Sample Run 2: Enter two integers: 55 121 GCD of 55 and 121 is 11arrow_forwardTrue or False: Asymptotically analyze the expression below. n²(1 +sqrt(n)) = O(n² log n) O True O Falsearrow_forward
- Basic Computer Programming ActivityLanguage: CShow the code and how it works thanksarrow_forwardComputer Engineering labarrow_forwardWrite a program that lets the user enter a charge account number. The program should determine if the number is valid by checking for it in the following list: 5658845 4520125 7895122 8777541 8451277 1302850 8080152 4562555 5552012 5050552 7825877 7881200 1250255 1005231 6545231 3852085 7576651 4581002 Initialize a one-dimensional array with these values. Then use a simple linear search to locate the number entered by the user. If the user enters a number that is in the array, the program should display a message saying the number is valid. If the user enters a number not in the array, the program should display a message indicating it is invalid.arrow_forward
- Python:Write a program that prompts you to type an integer value and indicates whether the number is: Positive torqueOdd positiveNegative torqueNegative oddFor this exercise, consider the value 0 as a positive pair.arrow_forward23. A perfect number is a positive integer that is equal to the sum of its positive divisorsexcept the number itself. The first two perfect numbers are 6 and 28 since 6=1+2+3and 28=1+2+4+7+14. Write a computer program that finds thefirst four perfect numbersarrow_forwardCode in Java using Do-while Loop Write a program that accepts an integer input. If the integer is positive, print the values from the positive integer down to zero. Otherwise, if it is negative, print the values from the negative integer up to zero. Separate each number with a space. Input 1. One line containing an integer Output Enter a number: 5 5 4 3 2 1 0arrow_forward
- Javaarrow_forwardProgram in JAVA using While Loop Write a program that takes a positive integer input and prints the numbers starting from input until 0 in one line where each numbers are separated by a space. Note: There's an initial code prepared for you. Go directly to the code editor file and complete the solution. Input 1. A positive integer input Output Enter a number: 5 5 4 3 2 1 0arrow_forwardJava use While loop: Write a program that creates two random numbers, ask user to finde the sum of them, takes the user input, check if it true, if so print " You got it ", if not prints " try again ".arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY