Write a C program to store some integer variables in an array. (Q9)
#include<stdio.h> #includeint main(){int n[10],count=0,sum=0;int *ptr; ptr = (int*) malloc (10 * sizeof(int) );pritf(“Enter array elements”);for (int i=0;i<10;i++){scanf(“%d”,&n[i]);} for(inti=0;i<10;i++){if(n[i]%3==0){(ptr+i)=n[i]; count++; printf(“%d\n”,(ptr+i));sum=sum+*(ptr+i);} […]
Write a C program to store some integer variables in an array. (Q9) Read More »