Calculate the Sum and Average of 3 numbers

Input 3 numbers from the user and calculate and print the sum and average.

/*
Calculate Sum And Average of Three Numbers
Shaswat Saxena
10/11/2017
*/
#include <stdio.h>
#include <conio.h>
void main()
  {
  int a,b,c;
  float sum,avg;
  clrscr();
  printf("Enter the Three Numbers : a , b and c\n");
  scanf("%d%d%d",&a,&b,&c);
  //Calculate Sum and Average
  sum=a+b+c;
  avg=sum/3;
  printf("The Sum is %f\n",sum);
  printf("The Average is %f\n",avg);
  getch();
}

Output

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Recommended for You  Find the largest of 3 numbers

Leave a Reply

Close Menu