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 the important feature of inheritance?

0 Answers   BPL,


What is the real time example of encapsulation?

0 Answers  


which are the 4 members functions in c++ objects that can either be declared explicitly by programmer or implementation if nt available.

4 Answers  


Difference between over loading and over ridding?

12 Answers   CTS, Patni, Softvision Solution,


What is Hashing and how is it done? Pictorial form?

2 Answers   emc2, Wipro,






What is multidimensional array?

1 Answers  


What normal C constructs work differently in C++?

2 Answers  


What is data binding in oops?

0 Answers  


what is the difference between containership and inheritence?

1 Answers  


how to find the largest of given numbers in an array

2 Answers  


What is the difference between a constructor and a destructor?

0 Answers  


What is a superclass in oop?

0 Answers  


Categories