Write a program in c++ to read two floating point numbers
and find their sum and average.

Answers were Sorted based on User's Feedback



Write a program in c++ to read two floating point numbers and find their sum and average...

Answer / 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

Write a program in c++ to read two floating point numbers and find their sum and average...

Answer / mahmali

#include<iostream.h>
#include<conio.h>
main()
{

float a,b,sum,avg;
cout<<"Enter values of a and b";
cin>>a>>b;

sum=a+b;
avg=sum/2;
cout<<"sum of the no.="<<sum;

cout<<"avg of the no.="<<avg;

getch();
}

Is This Answer Correct ?    2 Yes 5 No

Post New Answer

More OOPS Interview Questions

what is object slicing?

9 Answers   L&T, Wipro,


write a c++ program to find maximum of two numbers using inline functions.

3 Answers   IBM,


class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash

0 Answers  


difference between class and object

10 Answers   Chandan, IBM, Magic Soft,


What is Iteration Hierarchy? What is what is Object behavioral concept?

1 Answers  






What is the point of polymorphism?

0 Answers  


what is runtime polymorphism? For the 5 marks.

3 Answers  


Difference between realloc() and free?

9 Answers   HP,


What do you mean by binding of data and functions?

3 Answers  


who is the father of OPPS

4 Answers   Infosys, TCS,


what is difference between objects and function

3 Answers  


What is object in oop?

0 Answers  


Categories