average 3 float number in c code example

Example: c program to find average of 3 numbers

#include <stdio.h>

int main(void) 
{
  // these numbers can be whatever you want
  int number = 1231231;
  int number2 = 1231232;
  int number3 = 1;
  
  // add up all the numbers you want to average, then divide it by the total amount of numbers. In this case there are 3 numbers, so you divide it by three.
  int average = number + number2 + number3 / 3;
    
  // prints the average
  printf("%i", average);
}

Tags:

C Example