Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions