WRITE IN C PROGRAMMING LANGUAGE AND EXPLAIN PLEASE Write a p
**WRITE IN C PROGRAMMING LANGUAGE AND EXPLAIN PLEASE
Write a program that asks the user to type 10 integers of an array. The program must compute and write how many integers are greater than or equal to 10.
Solution
A program that asks the user to type 10 integers of an array and which compute and write how many integers are greater than or equal to 10 is :-
#include<stdio.h>
int main()
{
int a[10]; // a is an array of 10 integers.
int n,i,counter=0;
printf(\"\ Enter No of integers of an array\") ;
scanf(\"%d\",&n) ;
printf(\"\ Enter the values\") ;
// Reading values into Array
for(i=0;i<n;i++)
{
scanf(\"%d\",&a[i]) ;
if (a[i]>=10) // checking whether integers are greater than or equal to 10
counter++ ; // counter++ will be incremented everytime when if condition is true.
}
// counter variable displays the total no of integers are greater than or equal to 10.
printf(\"the number of integers are greater than or equal to 10 is:%d\",counter) ;
getch() ;
return 0 ;
}
