text: Average of odd numbers till a given odd number | Program to find average of odd numbers till a given odd number . ; Function to calculate the average of odd numbers ; driver function
code: #include <stdio.h> NEW_LINE int averageOdd ( int n ) { if ( n % 2 == 0 ) { printf ( " Invalid ▁ Input " ) ; return -1 ; } return ( n + 1 ) / 2 ; } int main ( ) { int n = 15 ; printf ( " % d " , averageOdd ( n ) ) ; return 0 ; }