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 runtime polymorphism? For the 5 marks.

3 Answers  


What is class in oop with example?

0 Answers  


how do you handle yourself when you feel the wald is aganist you

2 Answers  


which is best institute to learn c,c++ in ameerpet hyderabad

1 Answers  


WHEN A COPY CONSTER IS CALL ?

4 Answers  


Program to open a file with First argument

1 Answers   TCS,


Is oop better than procedural?

0 Answers  


what is static?

4 Answers  


what is a binary overloading

2 Answers  


Conversion from a basic type to a class type may be achieved using______________

5 Answers   HCL,


What is static in oop?

0 Answers  


What is encapsulation?

17 Answers   TCS,


Categories