WAP to ask the user to enter any 10 numbers and print the sum and average of only those numbers that are a multiples of 6.
Answers
Answered by
1
Answer:
#include<stdio.h>
void main(){
int a[10],sum=0,c=0;
float avg;
printf("Enter 10 no.s\n");
for(int i=0;i<10;i++){
scanf("%d",&a[i]);
if(a[i]/6!=0){
c+=1;
a[i]=0;
}
sum+=a[i];
}
avg=sum/(10-c);
printf("%d is sum\t %f is avg,sum,avg");
}
Hope it helps
Similar questions