An array containing 30 predefined float values are already provided for you in the code editor. Print each of the element out in separate lines, starting from the last array element down to the first. Each outputted value must also only show up to two decimal places.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.3: Declaring And Processing Two-dimensional Arrays
Problem 7E: (Electrical eng.) a. An engineer has constructed a two-dimensional array of real numbers with three...
icon
Related questions
Question

[C Program]

3. Float Count-off

by CodeChum Admin

Counting off a list of float numbers is hard when you speak it, but not when you code it! Don't believe me? Then let's try coding just that!

 

Instructions:

  1. An array containing 30 predefined float values are already provided for you in the code editor. Print each of the element out in separate lines, starting from the last array element down to the first.
  2. Each outputted value must also only show up to two decimal places.

Output

Multiple lines containing a float number.

2.41
143.00
3.14
3.12
0.00
-321.12
-414.12
12312.10
4.10
2.42
.
.
.
 
----------------------------------
#include<stdio.h>

int main(void) {
    
    float nums[30] = {
        1.4, 1.2054, 2.2, 2.5, 3.66, 
        3.0, 4.024, 4.00001, 5.5, 5.10,
        1, 2, 3, 4, 5,
        -1.11, -1.111, -1.1111, -1.11111, -1.111111,
        2.421, 4.1, 12312.1, -414.123, -321.12,
        0, 3.123, 3.14, 143, 2.412
    };
    
    return 0;
}
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
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