32.1k views
0 votes
. Dеclarе a onе-dimеnsional array of 30 doublеs (on thе stack) namеd rainfall

User Idjaw
by
8.7k points

1 Answer

4 votes

Answer:

double rainfall[30];

Step-by-step explanation:

Here we are declared an onе dimеnsional array named " rainfall " of size 30 and type double.To declared a onе dimеnsional array we can use the following syntax.

datatype array-name[size];

So double rainfall[30];

Following are the program in c++

#include<iostream> // header file

using namespace std; // namespace

int main() // main method

{

double rainfall[30]={45.5,78.9,67.78}; // array declaration and storing values

for(int i=0;i<3;++i) // iterating loop

{

cout<<rainfall[i]<<endl; // printing the array elements

}

return 0;

}

Output:

45.5

78.9

67.78

User Howard Renollet
by
8.7k points