Write a C program such that it prints out every element smal

Write a C program such that it prints out every element smaller than 40 of array A [5,16,87,65,4,32,11,108,10,25,12,27,56,38].

Solution

#include <stdio.h>

int main() {
int i;
int A[] = {5,16,87,65,4,32,11,108,10,25,12,27,56,38};
for(i=0; i<15; i++){
if(A[i] < 40){
printf(\"%d \", A[i]);
}
  
}
printf(\"\ \");
return 0;
}

Output:

sh-4.2$ gcc -o main *.c                                                                                                                                                                                                                                                

sh-4.2$ main                                                                                                                                                                                                                                                           

5 16 4 32 11 10 25 12 27 38 0

Write a C program such that it prints out every element smaller than 40 of array A [5,16,87,65,4,32,11,108,10,25,12,27,56,38].Solution#include <stdio.h> i

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site