fork download
  1. /*Program to read three values
  2. a.Sum of three values
  3. b.Average of three values
  4. c.Largest of the three*/
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. int main() {
  9. // your code goes here
  10. int a,b,c;
  11. cout<<"Enter the three values"<<endl;
  12. cin>>a>>b>>c;
  13. cout<<"The sum of numbers is:"<<a+b+c<<endl;
  14. cout<<"The average of three numbers is:"<<(a+b+c)/3.0<<endl;
  15. if(a>b&&a>c)
  16. cout<<"The greatest value is"<<a;
  17. else
  18. if(b>a&&b>c)
  19. cout<<"The greatest value is"<<b;
  20. else
  21. cout<<"The greatest value is:"<<c;
  22.  
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5456KB
stdin
23
11
34
stdout
Enter the three values
The sum of numbers is:68
The average of three numbers is:22.6667
The greatest value is:34