write a program to input 10 numbers into an array. find how many numbers are greater than 20
Answers
Answered by
0
Answer:
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10];
int i ,count=0;
clrscr() ;
printf("Enter 10 numbers in array") ;
for(i=0; i<10;i++)
{
scanf("%d", &a[i]) ;
}
for(i=0; i<10;i++)
{
if(a[i]>20)
count++;
}
printf("Number of numbers greater than 20 in array =%d",count) ;
getch() ;
}
Answered by
1
// Example program
#include <iostream>
#include <string>
using namespace std;
int main()
{
int arr[10];
int arr_sum=0;
for(int i=0;i<10;i++)
{
cout<<"Enter the element : "<<i+1<<endl;
cin>>arr[i];
arr_sum+=arr[i];
}
cout<<"Sum of the array elements: "<<arr_sum<<endl;
}
Similar questions