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
}

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

  1. Kevin

    if there is void main then what is the need of getch If we type void main() we need not type getch

    Reply
  2. sachin khutan

    write the program ave of 5 numbers in simple cpp using cin cout

    Reply
  3. THOMAS ANYANJE

    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

    Reply
  4. Yash pathak

    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

    Reply
  5. Sandeep N.

    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!

    Reply

Leave a Reply

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