Question: Chapter 6 Loops ASSIGNMENT1 1. Write a program that finds the largest in a series of numbers entered by the user. The program must prompt
Chapter 6 Loops ASSIGNMENT1
1. Write a program that finds the largest in a series of numbers entered by the user. The program must prompt the user to enter numbers one by one. When the user enters 0 or a negative number, the program must display the largest nonnegative number entered:
Enter a number: 60
Enter a number: 38.3
Enter a number: 4.89
Enter a number: 100.62
Enter a number: 75.2295
Enter a number: 0
The largest number entered was 100.62
Notice that the numbers arent necessarily integers.
1. Write your program here:
#include
int main(){
return 0;
}
6.2
2. Programming Project 1 in Chapter 4 asked you to write a program that displays a two-digit number with its digits reversed. Generalize the program so that the number can have one, two, three, or more digits. Hint: Use a do loop that repeatedly divides the number by 10, stopping when it reaches 0.
2. Write your program here:
#include
int main(){
return 0;
}
3. Program: Calculating the Number of Digits in an Integer
The numdigits.c program calculates the number of digits in an integer entered by the user:
Enter a nonnegative integer: 60
The number has 2 digit(s).
The program will divide the users input by 10 repeatedly until it becomes 0; the number of divisions performed is the number of digits.
Writing this loop as a do statement is better than using a while statement, because every integereven 0has at least one digit.
3. Write your program here:
#include
int main(){
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
