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

Write a program to get the binary tree.

3 Answers   ABC,


What are the 4 pillars of oop?

0 Answers  


What is variable example?

0 Answers  


what is the use of template classes in c++

1 Answers  


How many human genes are polymorphic?

0 Answers  






How do you use inheritance in unity?

0 Answers  


Can we create object of class with private constructor?

5 Answers  


What are the four main oops concepts?

1 Answers  


which is platform independent device used in computers

2 Answers  


What is and I oop mean?

0 Answers  


what is the new version of c++

1 Answers   Ignou, Pramata, Satyam,


What is stream in oop?

0 Answers  


Categories