Commit ff663b31 by emonyi

Upload New File

parent 2f54c510
Showing with 33 additions and 0 deletions
/*
* Bonus Task 3
* */
#include <stdio.h>
#include <stdlib.h>
int main(){
int i, n, even_count=0;
int array[12];
float ave, sum;
for(i=0; i < 12; i++){
printf("Enter the 12 numbers: ");
scanf("%d", &array[i]);
n=array[i]%2;
if(n==0){
sum= sum + array[i];
even_count=even_count + 1;
}
}
ave = sum/even_count;
printf("The average of the even numbers is: %.2f", ave);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment