Write a program in c++ to read two floating point numbers
and find their sum and average.
Answer Posted / kiranlivz
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float a,b,sum,avg;
cout<<"Enter 2 digits"<<endl;
cin>>a>>b;
cout<<"the 2 digits are:"<< " ";
cout<<a<<" "<<b<<;
sum=a+b;
avg=(a+b)/2;
cout<<"sum of the no."<<" ";
cout<<sum<<endl;
cout<<"avg of the no."<<" ";
cout<<avg;
getch();
}
| Is This Answer Correct ? | 15 Yes | 10 No |
Post New Answer View All Answers
What is static modifier?
What is meant by oops concept?
assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).
Why we use classes in oop?
What is abstraction in oops with example?
Which language is pure oop?
Can we create object of interface?
Why it is called runtime polymorphism?
What are constructors in oop?
What is coupling in oops?
What is an example of genetic polymorphism?
What is oops with example?
what is difference between class template and template class?
Why is static class not inherited?
What is the highest level of cohesion?