C++ Program to calculate sum and average of three numbers

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr() //to clear the screen
float a,b,c,sum,av;
cout<<“Enter three numbers:”;
cin>>a>>b>>c;

sum=a+b+c;
av=sum/3;
cout<<“nSUM=”<<sum;
cout<<“nAverage=”<<av;

getch(); //to stop the screen
}

16 thoughts on “C++ Program to calculate sum and average of three numbers”

  1. please write a program class tollbooth. with three members. 1. payingcar() increments car total and adds 50 shillings to the total cash collected,2nopaycar() increments the car total and adds nothing to the total cash,3.display() displays the two totals.the program should allow the user output total cars and cash and exit. thanks i like your work

  2. Buddy..Please Post a simple program to the sum abd average of three numbers very simply bcs i am in 7th std…i need that quickly plz help

  3. Hey could you please let me know how to get this code running in codeblocks? I have a problem running your cpp programs in CodeBlocks IDE. C works fine, just that I am unable to run C++ programs. Even #include is being read as a fatal error.

    Thanks in advance!

Leave a Comment

Your email address will not be published. Required fields are marked *