Learn C++ beginer programs

July 5, 2009

Write a program to find average of three numbers

Filed under: average,cin,cout,numbers — snehilkhanor @ 5:32 pm
Three numbers are taken(Input) from the user and avg of these three nos. is calculated(Output).

Select To use this code as it is.. select and copy paste this code into code.cpp file :)
  1. #include <iostream.h>
  2. #include <conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. int a,b,c,d,avg;
  7. cout<<”enter a no. “;
  8. cin>>a;
  9. cout<<”enter another no. “;
  10. cin>>b;
  11. cout<<”enter another nos “;
  12. cin>>c;
  13. d=a+b;
  14. avg=d/3;
  15. cout<<”The average is “<<s;
  16. getch();
  17. }

Theme: Rubric. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.