4. Write a C program that reads a floating-point number and prints "zero" if the number is zero. Otherwise, print "positive" or "negative". Add "small" if the absolute value of the number is less than 1, or "large" if it exceeds 1,000,000. Test Data Input value: 25 Expected Output : Positive number

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section4.2: The If-else Statement
Problem 3E
icon
Related questions
icon
Concept explainers
Question
4. Write a C program that reads a floating-point number and prints "zero" if the number is zero.
Otherwise, print "positive" or "negative". Add "small" if the absolute value of the number is less than 1,
or "large" if it exceeds 1,000,000.
Test Data
Input value: 25
Expected Output :
Positive number
5. Write a C program that keeps a number from the user and generates an integer between 1 and 7 and
displays the name of the weekday.
Test Data
Input number: 3
Expected Output :
Wednesday
6. Write a C program that reads in two floating-point numbers and tests whether they are the same up
to three decimal places.
Test Data
Input floating-point number: 1256
Input floating-point another number: 3254
Expected Output :
They are different
Transcribed Image Text:4. Write a C program that reads a floating-point number and prints "zero" if the number is zero. Otherwise, print "positive" or "negative". Add "small" if the absolute value of the number is less than 1, or "large" if it exceeds 1,000,000. Test Data Input value: 25 Expected Output : Positive number 5. Write a C program that keeps a number from the user and generates an integer between 1 and 7 and displays the name of the weekday. Test Data Input number: 3 Expected Output : Wednesday 6. Write a C program that reads in two floating-point numbers and tests whether they are the same up to three decimal places. Test Data Input floating-point number: 1256 Input floating-point another number: 3254 Expected Output : They are different
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Operators
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr