Type in a code to declare an array myArray of 14 integers and enter the elements values using the cin operator
Answers
Answered by
3
include <iostream>
#include<conio.h>
using namespace std;
int main()
{
int a[10],i,b=0,N=10; //declaration
cout<<"Enter the array:\n"; //enter 10 number
for(i=0;i<N;i++) //for loop to gather data
{
cin>>a[i]; //arrays of 10 integers
if (a[i]>=10) //check whether the integers are greater or equal to 10
b++; //in crement
}
cout<<"The number of integers greater or equal to 10 is: "<<b;
getch();
}
plssssss mark brainliest
plssssss follow me
byeeeeee
Answered by
1
Following are the code in C++ language
#include <iostream> // header fileusing namespace std; // namespace
int main() // main function
{
int k; // variable declaration
int myArray[14]; // declaration of array
cout<<"Enter the elements :"
for(k=0;k<14;++k) // iterating the loop
{
cin>>myArray[k]; // Read the value of array
}
return 0;
}
Explanation:
Following are the description of code:
- Declared a variable "k" of "int" type.
- Declared an array i.e "myArray" of int type of size 14.
- After that iterating the for loop we start the from k=0 because the array index always starts at 0 so we start with 0 and less then 14.
- Inside the loop the cin statement is used which read the value of int type from user.
Learn More:
- brainly.in/question/3152160
Similar questions